How can I use a script to find a particular globally unique identifier (GUID) for a Group Policy Object (GPO)?

A. Using the script in the FAQ "How can I get a list of all Group Policy Objects (GPOs) in the domain?" we can modify the LDAP search query with a (name=\{GUID to search for\}) so that it only returns a match. The script is basically the same except that it takes two parameters and adds a query into the search:

' Check whether all arguments required have been passed.
If Wscript.Arguments.Count 
Here's a sample execution and output:

D:\Temp>cscript searchforgpo.vbs dc=savilltech,dc=com \{01D59D61-5417-45A7-96B3-9F694CC686C0\}

GUID: \{01D59D61-5417-45A7-96B3-9F694CC686C0\} Name: Auto Enrollment

You can even use wildcard combinations, as the following example shows
D:\Temp>cscript searchforgpo.vbs dc=savilltech,dc=com *b5*

GUID: \{9A0C4F9C-C079-4929-AED0-BBBEB590EAA8\} Name: Service Delegation
GUID: \{E48AF63C-F8EE-41C6-B943-175B1B5EAF93\} Name: DisplaySetting1
GUID: \{D5BB4DC1-3270-4992-B5BC-E9B55A874347\} Name: DisplaySetting2
Hide 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.