Connect to object GUID (VBScript)

This code can be found in Chapter 4 of Active Directory Cookbook, 2nd edition

Purchase XP Cookbook or Networking Recipes for only $25 plus shipping! While supplies last.

Find out how to download all of the VBScript code from this site.

' This code illustrates how to bind to an object GUID.
' ------ SCRIPT CONFIGURATION ------
strDomain = "<DomainDNSName>"   ' e.g. apac.rallencorp.com
strGUID = "GUID>" ' e.g. "aa312825768811d1aded00c04fd8d5cd"
					' for the default Computers container
' ------ END CONFIGURATION ---------
     
set objRootDSE = GetObject("LDAP://" & strDomain & "/RootDSE")
set objContainer = GetObject("LDAP://<GUID=" & _
                             strGUID & "," & _
                             objRootDSE.Get("defaultNamingContext") & ">" )
WScript.Echo objContainer.Get("distinguishedName")

This code has been viewed 3344 times.

New from the creators of TechTasks.com: StatSheet.com