SCCM 2007 PowerShell“更新集合成员资格”

有Powershell命令/脚本,可以设置为运行一个特定的集合和子集合“更新集合memebership”? 如果不是Powershell除了右键单击收集并手动运行更新集合的另一种方式?

我使用WMI定期执行此操作。 简单的function:

$YourSCCMServer = '?' $YourSite = '?' $WMIStatic = @{ ComputerName = "$YourSCCMServer" NameSpace = "root\sms\site_$YourSite" } function Update-Collection { param ($Filter) Get-WmiObject @WMIStatic -Class SMS_Collection @PSBoundParameters | Invoke-WmiMethod -Name RequestRefresh } Update-Collection -Filter "CollectionID = 'SMS00001'" 

你只需要填写空白。 并写一个filter,包括你之后的集合。

编辑 :命名空间错字,不知道第一个反斜杠来自哪里。 顺便说一句:列表最好包括通配符: -List Collection不会返回任何结果, -List *Collection*会。