Re: Getting GPO names
- From: "AustinJames" <AustinJames@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 2 Jun 2005 08:38:04 -0700
OK great. Thanks Torgeir it works well.
I have noticed that you are building the array by the ';0]' delimiter. I've
noticed that sometimes there is a ';2]' delimiter on some policies? What is
this value?
Follow up question. Given the name or the AdsPath, how do I go about
getting the settings in such policy?
Sorry about the multiple post. New to the newsgroup thing. My apologies.
Austin
"Torgeir Bakken (MVP)" wrote:
> AustinJames wrote:
>
> > Has anybody found or seen of a way to list which GPOs are linked
> > to a givencontainer in a script? I'm just looking for syntax that
> > will allow me to get the name of the GPO that is linked to the
> > container.
> >
> > I'm thinking something like,
> > get container list from AD
> > for each container
> > get linked GPO names, if any
> > next GPO
> > next container
> >
> > I know that the example isn't written in code, sorry. I'm just
> > having trouble finding syntax for the 'get linked GPO name' and
> > 'next GPO' concepts.
> >
> > I need to run this as a script.
> > Any help out there?
> Hi,
>
> Try this:
>
> '--------------------8<----------------------
>
> ' Bind to container/OU.
> Set objOU = GetObject("LDAP://ou=LevelOne,dc=lab,dc=local")
>
> ' Retrieve gPLink attribute
> strGPLinkList = objOU.gPLink
>
> If IsEmpty(strGPLinkList) Then
> WScript.Echo "No GPOs are linked"
> Else
> arrGPLinks = Split(strGPLinkList, ";0]")
>
> ' don't use the last entry in the array, it is empty
> For i = 0 To UBound(arrGPLinks) - 1
>
> ' remove the left [ character
> strGPLinkPath = Mid(arrGPLinks(i), 2)
>
> WScript.Echo "GPO AdsPath: " & strGPLinkPath
> Set objGPO = GetObject(strGPLinkPath)
> WScript.Echo "GPO Name: " & objGPO.Name
> WScript.Echo "GPO DisplayName: " & objGPO.DisplayName
> WScript.Echo "GPO Description: " & objGPO.Description
> Next
> End If
>
> '--------------------8<----------------------
>
>
> --
> torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
> Administration scripting examples and an ONLINE version of
> the 1328 page Scripting Guide:
> http://www.microsoft.com/technet/scriptcenter/default.mspx
>
.
- References:
- Getting GPO names
- From: AustinJames
- Re: Getting GPO names
- From: Torgeir Bakken \(MVP\)
- Getting GPO names
- Prev by Date: Account permissions
- Next by Date: Re: Add AD user to ADAM-group
- Previous by thread: Re: Getting GPO names
- Next by thread: Rebuilding Active Directory indices
- Index(es):
Relevant Pages
|