在Get-WMIobject中使用Out-null

时间:2015-07-10 13:39:08

标签: powershell powershell-v2.0

Hello有人可以帮我隐藏Get-WMIobject查询的输出。试过out-null但我以后无法使用的参数

$CurrentPageFileC = (Get-WmiObject -computername $server -Namespace root\CIMV2 -Query "select * from Win32_PageFileSetting where name='c:\\pagefile.sys'") | out-null
$CurrentPageFileC.InitialSize = 4096
$CurrentPageFileC.MaximumSize = 4096
$CurrentPageFileC.put()

1 个答案:

答案 0 :(得分:0)

对不起,我错了,在错误的地方插入了out-null .. :)

$CurrentPageFileC = (Get-WmiObject -computername $server -Namespace root\CIMV2 -Query "select * from Win32_PageFileSetting where name='c:\\pagefile.sys'") 
$CurrentPageFileC.InitialSize = 4096
$CurrentPageFileC.MaximumSize = 4096
$CurrentPageFileC.put() |out-null