Listing01_RootDSE (VBScript)

This code can be found in Chapter 5 of Managing Enterprise Active Directory Services

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.

'# From the book "Managing Enterprise Active Directory Services"
'# ISBN: 0-672-32125-4

On Error Resume Next
Dim wmi_path
wmi_path = ("winmgmts://dc1/root/directory/LDAP:RootDSE=@"
set rootDSE = GetObject(wmi_path)
if err <> 0 then
   WScript.Echo ErrNumber, Err.Source, Err.Description
else
   WScript.Echo "dnsHostName:          " & rootDSE.dnsHostName
   WScript.Echo "defaultNamingContext: " & rootDSE.defaultNamingContext
end if

This code has been viewed 1370 times.

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