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=""></a> to 
' delete the following registry value. The value will prevent 
' the abilityof anSCCM client to become reassigned to the new
' ConfigMgr 2012 site.
' 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

8 thoughts on “ConfigMgr Client GPO Assignment Removal

    Daniel Ruiz said:
    October 18, 2012 at 9:10 am

    WOW!!! I just ran into this same situation. I would have NEVER figured this out. Thanks!

    PK said:
    December 4, 2012 at 1:21 pm

    How do I run this script before the configmgr update? I can’t seem to find that anywhere.. thanks

      N. Moseley responded:
      December 4, 2012 at 1:27 pm

      You’ll need to add the script into it’s own package, create it’s own program, then have the Program which runs the SCCM client upgrade run that script package/program first.

        PK said:
        December 4, 2012 at 1:34 pm

        Thanks for the info. I was thinking that was built in for some reason.. ie the ability to add pre client install packages.

        Nice script, saved me from writing one.


        N. Moseley responded:
        December 4, 2012 at 1:36 pm

        Glad to help! Thanks for the feedback too

        PK said:
        December 6, 2012 at 1:06 pm

        I can’t seem to find out how to do this.. won’t the configmgr be required to deploy packages to a computer? Therefore, I wouldn’t be able to right a custom package for the installation of the configmgr… what am I missing? tia

        N. Moseley responded:
        December 6, 2012 at 1:08 pm

        If you can’t use SCCM to deploy the script, then you’ll have to use some other means.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s