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
VB Script

Avatar of undefined
Last Comment
RobSampson

8/22/2022 - Mon
RobSampson

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.
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
RobSampson

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.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
ASKER CERTIFIED SOLUTION
stubar

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
RobSampson

Thanks for the info Stuart.

Rob.