Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there Powershell command/script that can be setup to run an "update collection memebership" on a specific collection and subcollections? If not Powershell another way besides right click on Collection and manually run an update collection?

share|improve this question
up vote 1 down vote accepted

I do it on regular basis using WMI. Simple function that does it:

$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'"

You just need to fill in the blanks. And write a filter that would include collections you are after.

EDIT: Typo in namespace, not sure where first backslash came from. BTW: for list it's better to include wildcards: -List Collection would not return any results, -List *Collection* would.

share|improve this answer
Is this for PS V3.0? I tried this Get-WmiObject @WMIStatic -Class Collection -List as your example but I get error Get-WmiObject : Invalid parameter. I checked Namespace and Computername is right. – CWL Mar 13 '13 at 18:26
It's not v3 in any way - that was just typo in Namespace, now fixed. – BartekB Mar 13 '13 at 19:17
correct my test was using this - just left them off Get-WmiObject @WMIStatic -Class Collection -LIST (Yes, removing the \ was the issue) – CWL Mar 13 '13 at 19:48

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.