Returns resultant set of policy Linked Group Policies information for the logged-on user. This script contributed by Mike Stephens of Microsoft.

Visual Basic
Edit|Remove
Const FL_FORCE_CREATE_NAMESPACE = 4

strComputer = "."

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 & "\User", null, null, Null, Null, 0 , Null)

WScript.Echo "User RSOP of Linked Group Policies"

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

For Each objItem in colItems
    WScript.Echo String(50, "=")
    Wscript.Echo "GPO: " & objItem.GPO
    Wscript.Echo "Applied Order: " & objItem.AppliedOrder
    Wscript.Echo "Enabled: " & objItem.Enabled
    Wscript.Echo "Link Order: " & objItem.LinkOrder
    Wscript.Echo "No Overrride: " & objItem.NoOverride
    Wscript.Echo "SOM Order: " & objItem.SOMOrder
Next

provider.RsopDeleteSession namespaceLocation, hResult