Remove all the local policies on a Windows device.

If you cannot create an administrator using command prompt to reset your group policies.

  1. Copy the script below to a notepad & then save it as {file name}.vbs
  2. Run the script.

This should reset all the Local GPO’s applied

    If WScript.Arguments.Count = 0 Then
    Set objShell = CreateObject("Shell.Application")
    objShell.ShellExecute "wscript.exe", Chr(34) & WScript.ScriptFullName & Chr(34) & " Run", , "runas", 1
Else

set winsh = CreateObject("WScript.Shell")
set winenv = winsh.Environment("Process")
windir = winenv("WinDir")

strPath = (WinDir & "\System32\GroupPolicy")

    DeleteFolder strPath

    Function DeleteFolder(strFolderPath)
    Dim objFSO, objFolder
    Set objFSO = CreateObject ("Scripting.FileSystemObject")
    If objFSO.FolderExists(strFolderPath) Then
    objFSO.DeleteFolder strFolderPath, True
    End If
    Set objFSO = Nothing
    End Function

strPath = (WinDir & "\System32\GroupPolicyUsers")

    DeleteFolder strPath

    Function DeleteFolder(strFolderPath)
    Dim objFSO, objFolder
    Set objFSO = CreateObject ("Scripting.FileSystemObject")
    If objFSO.FolderExists(strFolderPath) Then
    objFSO.DeleteFolder strFolderPath, True
    End If
    Set objFSO = Nothing
    End Function

winsh.Run "gpupdate /force", 0

End If

Also refer to How to reset local group policies

Leave a Comment