VBS Script To Find A Configuration Manager Collection ID For Specified Collection Name

 

This VBS Script will allow you to find the collection ID for a specified collection name.

 

VBS Script:

 

strComputer = InputBox ("Enter Site Server Name")

strSiteCode = InputBox ("Enter Site Code")

strName = InputBox ("Enter Collection Name")

 

Set objWMIService = GetObject("winmgmts://" & strComputer & "\root\sms\site_" & strSiteCode)

Set colItems = objWMIService.ExecQuery("Select * From SMS_Collection Where Name = '" & strName & "'")

 

For Each objItem in colItems

MsgBox "Collection ID: " & objItem.CollectionID _

& Chr(13) & "Collection Name: " & objItem.Name

 

Next

 

 

Published Monday, February 16, 2009 2:47 PM by dhite
Filed under:

Comments

No Comments