Re: Getting GPO names



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



Relevant Pages

  • Re: Getting GPO names
    ... I'm just looking for syntax that will allow me to get the name of the GPO that is linked to the container. ... torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway Administration scripting examples and an ONLINE version of the 1328 page Scripting Guide: ...
    (microsoft.public.windows.server.active_directory)
  • Re: Organizational Units
    ... I have done group policy for some time this way by ... >Unit and place either user account objects and /or ... >Security Groups to filter the GPO, ... >'users' (remember that this is a container and that you ...
    (microsoft.public.win2000.active_directory)
  • Re: Organizational Units
    ... Unit and place either user account objects and /or computer account objects ... Security Groups to filter the GPO, some) of the user account objects / ... moved all of the appropriate user account objects from the default container ...
    (microsoft.public.win2000.active_directory)
  • Re: AD Container
    ... I have 60 computers on this workstation OU, ... object container and because the reason M explain the machine now has no GPO ... so I can open control panel and wrok from there. ...
    (microsoft.public.windows.server.active_directory)
  • Re: Published application doesnt appear in GPO
    ... You will have to change the display name of the package in AD. ... Find the container under this one that corresponds to your GPO GUID. ...
    (microsoft.public.windows.group_policy)

Quantcast