GPO

ConfigMgr Client GPO Assignment Removal

Posted on Updated on

On a recent upgrade project of ConfigMgr 2007 to 2012, the company I was assisting with the upgrade had previously deployed a group policy to enforce the client assignment to the 2007 site code.  However, simply removing the GPO could not correct the situation as the value was “tattooed” into the registry.  So as part of the ConfigMgr client upgrade, I included the below script to revoke the registry key.


' ***********************************************************
' This script was created by <a href="https://t3chn1ck.wordpress.com/">https://t3chn1ck.wordpress.com</a> to 
' delete the following registry value. The value will prevent 
' the abilityof anSCCM client to become reassigned to the new
' ConfigMgr 2012 site.
' HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\SMS\Mobile Client\
' GPRequestedSiteAssignmentCode (REG_SZ) = ""
' ***********************************************************
Option Explicit
Const HKLM = &H80000002 Const sRegKey = "SOFTWARE\Microsoft\SMS\Mobile Client"
Const sRegValueName = "GPRequestedSiteAssignmentCode"
Dim oReg, iReturnValue
Set oReg = GetObject("winmgmts:\\.\root\default:StdRegProv")
iReturnValue = oReg.SetStringValue (HKLM, sRegKey, sRegValueName, "")
wscript.quit iReturnValue

Advertisement