Skip navigation

How can I use a script to get a list of all Group Policy Objects (GPOs) in the domain?

A. The following script, which you can download at http://www.windowsitpro.com/articles/download/listguid.zip , takes the distinguished name (DN) of a domain and returns a list of globally unique identifiers (GUIDs) that it uses to display the GPO names.


' Check that all arguments required have been passed.
If Wscript.Arguments.Count 

Here's a sample execution and output: D:\Temp>cscript listgpo.vbs dc=savilltech,dc=com

GUID: \{31B2F340-016D-11D2-945F-00C04FB984F9\} Name: Default Domain Policy
GUID: \{6AC1786C-016F-11D2-945F-00C04fB984F9\} Name: Default Domain Controllers Policy
GUID: \{A9AB07C1-5EAA-4E60-9507-F33524933E7A\} Name: Restrict Account Rights
GUID: \{CE948635-2E6E-4AAB-8F46-5CA7581528AF\} Name: Remove Service Account Rights
GUID: \{01D59D61-5417-45A7-96B3-9F694CC686C0\} Name: Auto Enrollment
GUID: \{BA7E1B25-7341-471E-8FEC-17B9E761DB35\} Name: Autoenrollment

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish