How To: Force an SMS Advanced Client to Re-Discover its Site

Here's a sample VBscript to remotely initiate a client re-discovery (just like clicking the "Discover" button on an SMS advanced client). 
strComputerName = "2kPro"
Set objWMIService = GetObject("winmgmts://" & strComputerName & "/root/ccm")
Set objSMSClient = objWMIService.ExecQuery("Select * from SMS_Client")
for each objClient in objSMSClient
 objClient.EnableAutoAssignment = 1
 objClient.Put_ 0
next
** After running the script above, you need to restart the SMS Agent Host Service. I have had mixed results using the WMI calls to restart the service, so I would recommend an alternative method, such as psservice from SysInternals. (If you figure out how to get consistent successfull service restarts using VBScript and WMI, please share!).
If you have additional questions or comments, please post to this blog, or send me and email: ramseyg@hotmail.com
Published Friday, October 20, 2006 8:00 PM by gramsey
Filed under: ,

Comments

No Comments
Powered by Community Server (Commercial Edition), by Telligent Systems