Restoring All Systems Collection in SCCM 2007

بسم الله الرحمن الرحيم

Sometimes we accidentally deleted important things.I deleted the All System Collection from SCCM 2007 console. I search for restoring the All System Collection with the appropriate ID SMS00001. I found many solutions but this solution is the best one.

Here’s how to restore the All System Collection with the appropriate ID SMS00001

VBS script that will do the restore:

####begin script

strSMSServer = “.”  
strParentCollID = “COLLROOT”   
‘This example creates the collection in the collection root.    
‘Replace COLLROOT with the CollectionID of an existing collection to make the new collection a child.

strCollectionName = “All Systems”  
strCollectionComment = “This is the All Systems Collection.”   
Set objLoc = CreateObject(“WbemScripting.SWbemLocator”)   
Set objSMS = objloc.ConnectServer(strSMSServer, “root\sms”)   
Set Results = objSMS.ExecQuery (“SELECT * From SMS_ProviderLocation WHERE ProviderForLocalSite = true”)

For each Loc in Results  
If Loc.ProviderForLocalSite = True Then   
  Set objSMS = objLoc.ConnectServer(Loc.Machine, “root\sms\site_” & Loc.SiteCode)   
End if   

Set newCollection = objSMS.Get(“SMS_Collection”).SpawnInstance_()

‘Create new “All Systems” collection  
newCollection.Name = “All Systems”   
newCollection.OwnedByThisSite = True   
newCollection.Comment = strCollectionComment   
newCollection.CollectionID = “SMS00001”   
path = newCollection.Put_

‘Set the Relationship  
Set newCollectionRelation = objSMS.Get(“SMS_CollectToSubCollect”).SpawnInstance_()   
newCollectionRelation.parentCollectionID = strParentCollID   
newCollectionRelation.subCollectionID = (“SMS00001”)   

####end script

How to make this script?

1- Create New Text Document on your Desktop and copy script on New Text Document and save it.

2- Rename New Text Document.txt to RestoringAllSystemsCollection.vbs (.TXT to .VBS)

3- Run the command  C:\Users\administrator\Desktop>cscript.exe “RestoringAllSystemsCollection.vbs”

You will found the All System Collection with the appropriate ID under Collections node in SCCM console. But you will need to import the All Systems query for your membership rules.

Follow these steps to import the All Systems query : 



There is an easy way. Re-apply SP2 (or SP1) and the collection will get re-create with the right ID SMS00001


About Mohamed Abd Elhamid

Microsoft System Administrator

Posted on September 7, 2011, in SCCM 2007 and tagged , . Bookmark the permalink. 2 Comments.

  1. One thing to note here is that if you restore the Collection it does not restore any advertisements you may have had targeted at the ‘All Systems’ collection.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: