Clearing previously applied GPO settings from a domain laptop

We have a fleet of laptops within our domain, and some of the GPO settings applied to them are causing VPN functionality issues.
We have created new GPOs which do not have the issue, however when we move the laptops to the new OU it seems like the previous problemmatic GPO settings are cached and remain in play. If we deploy a new laptop in the new OU with the new GPOs we have no problems.

I need to be able to clear out the old settings without removing the machine from the domain, or reimaging the laptops.

I have tried this script with success on only one out of 4 laptops, perhaps someone can help me figure out what's missing or incorrect. I created this from info found all over the web.

Any help is much appreciated!

DEL /S /F /Q "%ALLUSERSPROFILE%\Application Data\Microsoft\Group Policy\History\*.*"
REG DELETE HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies /f
REG DELETE HKLM\SOFTWARE\Policies\Microsoft /f
REG DELETE HKLM\SOFTWARE\Policies\Microsoft /f
REG DELETE "HKCU\Software\Microsoft\Windows\Currentversion\Group Policy Objects" /f
REG DELETE HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies /f
DEL /F /Q C:\WINDOWS\security\Database\secedit.sdb
Klist purge
gpupdate /force
gpupdate /force /boot
gpupdate /boot

I get some 'partial' errors when I run it:


C:\Users\michsmit\Desktop>DEL /S /F /Q "C:\ProgramData\Application Data\Microsof
t\Group Policy\History\*.*"
Deleted file - C:\ProgramData\Application Data\Microsoft\Group Policy\History\{0
Deleted file - C:\ProgramData\Application Data\Microsoft\Group Policy\History\{9
Deleted file - C:\ProgramData\Application Data\Microsoft\Group Policy\History\{C

C:\Users\michsmit\Desktop>REG DELETE HKLM\SOFTWARE\Microsoft\Windows\CurrentVers
ion\Policies /f
The operation completed successfully.

C:\Users\michsmit\Desktop>REG DELETE HKLM\SOFTWARE\Policies\Microsoft /f
ERROR: Delete request is partially completed.

C:\Users\michsmit\Desktop>REG DELETE HKLM\SOFTWARE\Policies\Microsoft /f
ERROR: Delete request is partially completed.

C:\Users\michsmit\Desktop>REG DELETE "HKCU\Software\Microsoft\Windows\Currentver
sion\Group Policy Objects" /f
ERROR: The system was unable to find the specified registry key or value.

C:\Users\michsmit\Desktop>REG DELETE HKCU\SOFTWARE\Microsoft\Windows\CurrentVers
ion\Policies /f
The operation completed successfully.

C:\Users\michsmit\Desktop>DEL /F /Q C:\WINDOWS\security\Database\secedit.sdb

C:\Users\michsmit\Desktop>Klist purge

Current LogonId is 0:0x9c423
        Deleting all tickets:
        Ticket(s) purged!

C:\Users\michsmit\Desktop>gpupdate /force
Updating Policy...

User Policy update has completed successfully.
Mike SmithAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Have you tried removing the group polices folders? Then reboot and apply new GPO upon reboot.
Mike SmithAuthor Commented:
Good comment, I have since added these two lines to the script but sadly those folders to not exist on the filesystem.
Are you certain UAC is not coming on?
Do you have anything in event log you can post/upload?
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Mike SmithAuthor Commented:
Unfortunately nothing shows up in the event log, it's possible it's UAC related though.

The current GPOs in the current OU work on a new imaged machine, but these 2 test machines that had the 'bad' gpo settings from the production OU somehow cached even after moving it, running the deletion scripts, updating gpos using gpupdate -- they still don't work.
Mike SmithAuthor Commented:
I believe it turned out that this was a replication issue of GPOs along with a incompatibility with checkpoint vpn software.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
So you have resolved the issue?
Mike SmithAuthor Commented:
we figured it out at long last
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Active Directory

From novice to tech pro — start learning today.