Checks to see if the Local GPO version in the GPT.ini file either has not been set or has a version number of zero. In either case, Group Policy will assume that no Local GPO policy settings exist. Script contributed by Microsoft's Mike Stephens and Judith Herman.

Visual Basic
Edit|Remove
'First find the windows directory which can be different on each machine
set wshshell = CreateObject("WScript.Shell")
windir = wshshell.ExpandEnvironmentStrings("%WINDIR%")

'Using the path relative to the windows directory look for the GPT.INI file
set objFSO = CreateObject("Scripting.FileSystemObject")

filename = windir & "\SYSTEM32\GROUPPOLICY\GPT.INI"
Set objTS = objFSO.OpenTextFile("c:\windows\SYSTEM32\GROUPPOLICY\GPT.INI")
strFileContents = objTS.ReadAll
objTS.Close

Set objRE = New RegExp

'Use the pattern of Carriage Return followed by the text "Version=" 
'with other characters following.
'The characters following the = sign are expected to be numbers.

objRE.Pattern = "\nVersion=.+"
objRE.Global = True
objRE.IgnoreCase = False

retVal = objRE.Test(strFileContents)
If retVal Then  
    'Check actual version number
    Set colMatches = objRE.Execute(strFileContents)
    For Each objMatch In colMatches
       strTmp = objMatch.Value
       arrResults = Split(strTmp,"=")
       If arrResults(1) = 0 Then
           wScript.Echo "LGPO version number is Zero"
       Else
           wScript.Echo "LGPO version number is nonZero"
       End If
    Next
Else
    'No version string interpreted as machine/user version = 0
    wScript.Echo "LGPO version number is Zero"
End If