Link to home
Start Free TrialLog in
Avatar of stubar
stubar

asked on

Help with vbscript and ADSI OLE DB provider to list GPO links

Hi
I need a script that output the GPO links for an OU. I've searched around and can see this one:
http://www.activexperts.com/activmonitor/windowsmanagement/adminscripts/usersgroups/ous/#ReturnGPOInfo.htm 
which comes from the Scripting Guys at MS but for whatever reason it does not give me the name of the GP.
Does anyone know of a better method or one that works :o)

Thanks for your time

Stuart
Avatar of RobSampson
RobSampson
Flag of Australia image

Hi, in that code, do you have a Sales OU, and have you changed the DC elements in the Set objContainer line?

Change this:

On Error Resume Next
Set objContainer = GetObject _
  ("LDAP://ou=Sales,dc=NA,dc=fabrikam,dc=com")

to this:

Set objRootDSE = GetObject("LDAP://RootDSE")
strOU = "OU=Sales,OU=Departments,"
Set objContainer = GetObject("LDAP://" & strOU & objRootDSE.Get("defaultNamingContext"))

and then we'll go from there if you get an error.

Regards,

Rob.
Avatar of stubar
stubar

ASKER

Thanks Rob
Getting error 80040E14 on the "  Set objRecordSet = objCommand.Execute" line in the Function GetGPOName.

This to me implies the function is not binding to AD. What do you think?
Put the previous code back in, with the On Error catch removed and it was still coming back to that line.

Stuart
OK, so above this line
Set objRecordSet = objCommand.Execute

if you put this:
MsgBox objCommand.CommandText

and then post that query string, I can see if the command is malformed at all, and help you get that working.

Regards,

Rob.
ASKER CERTIFIED SOLUTION
Avatar of stubar
stubar

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks for the info Stuart.

Rob.