Thursday, June 19, 2014

Temporarlily Disable Domain Group Policies

Every once in a while I need to do an A-B test on how something behaves with a Group Policy.  Under XP, I had found a tool that worked pretty well but when trying to find it again, I ran into this article: http://superuser.com/questions/379908/how-to-clear-or-remove-domain-applied-group-policy-settings-after-leaving-the-do

Here is the script that I created based on that information.

REM Remove Domain Group Policies
REM
REM Reference: http://superuser.com/questions/379908/how-to-clear-or-remove-domain-applied-group-policy-settings-after-leaving-the-do
REM Backing up the registry pieces
reg export "HKLM\Software\Policies\Microsoft" %userprofile%\desktop\gp_backup1.reg /y
reg export "HKCU\Software\Policies\Microsoft" %userprofile%\desktop\gp_backup2.reg /y
reg export "HKCU\Software\Microsoft\Windows\CurrentVersion\Group Policy Objects" %userprofile%\desktop\gp_backup3.reg /y
reg export "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies" %userprofile%\desktop\gp_backup4.reg /y


REM Delete all Domain Group Policies
REM can re-enable them with a gpupdate /force
REM or you can double-click on all registry backups
reg delete "HKLM\Software\Policies\Microsoft" /va /f
reg delete "HKCU\Software\Policies\Microsoft" /va /f
reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Group Policy Objects" /va /f
reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies" /va /f