This is a quick way to update a client’s site code. Make sure you run as admin.
I ended up needing this, because while our SCCM was being configured at the forest level (which took a while), I was already testing the SCCM server. Without this, the clients could not communicate with the server.
Set objShell = CreateObject("WScript.Shell") set objSMSClient = CreateObject ("Microsoft.SMS.Client") 'update site code objSMSClient.SetAssignedSite "ABC",0 'restart process objShell.Run "C:\Windows\CCM\CcmRestart.exe",0,true msgbox " Site code has been changed!"