Returns resultant set of policy Administrative Template information for a computer. This script contributed by Mike Stephens of Microsoft.

Visual Basic
Edit|Remove
Const FL_FORCE_CREATE_NAMESPACE = 4

strComputer = "."

Set wDate = CreateObject("WbemScripting.SWbemDateTime")
Set locator = CreateObject("WbemScripting.SWbemLocator")
Set connection = locator.ConnectServer( strComputer, "root\rsop", null, null, null, null, 0, null)
Set provider = connection.Get("RsopLoggingModeProvider")
provider.RsopCreateSession FL_FORCE_CREATE_NAMESPACE, Null, namespaceLocation, hResult, eInfo

Set rsopProv = locator.ConnectServer _
    (strComputer, namespaceLocation & "\Computer", null, null, Null, Null, 0 , Null)

WScript.Echo " Computer Administrative Template Logging"

Set colItems = rsopProv.ExecQuery("Select * from RSOP_AdministrativeTemplateFile")

For Each objItem in colItems  
    WScript.Echo String(50, "=")
    Wscript.Echo "Name: " & objItem.Name
    Wscript.Echo "GPO ID: " & objItem.GPOID
    wDate.Value = objitem.lastWriteTime
    Wscript.Echo "Last Write Time: " & FormatDateTime( wDate.GetVarDate() , vbShortDate) & " " & _
        FormatDateTime( wDate.GetVarDate(), vbShortTime)
Next

provider.RsopDeleteSession namespaceLocation, hResult