Categories
Microsoft

SCCM : Client Site Code Change

SCCM : Client Site Code Change

I had a need recently to change the site code of some SCCM cliwents that had already been deployed. I used the following vbScript to change the site code of a client (remotely or locally!), the script can be integrated into a logon script to automate the process if desired:

{code lang:ini title:”vbScript” lines:true hidden:false}’Replace NEW_SITE with your Site Code
sSiteCode = “NEW_SITE”
sMachine = “.”
set oCCMNamespace = GetObject(“winmgmts://” & sMachine & “/root/ccm”)
Set oInstance = oCCMNamespace.Get(“SMS_Client”)
set oParams = oInstance.Methods_(“SetAssignedSite”).inParameters.SpawnInstance_()
oParams.sSiteCode = sSiteCode
oCCMNamespace.ExecMethod “SMS_Client”, “SetAssignedSite”, oParams {/code}

Leave a Reply

Your email address will not be published. Required fields are marked *