Contact Info

Crumbtrail

ActiveXperts.com » Administration » Scripts » WMI » vbscript sample

MSAD vbscript sample code

The foundations for Manageability in Windows is Windows Management Instrumentation (WMI; formerly WBEM) and WMI extensions for Windows Driver Model (WDM).

ActiveXperts Network Monitor provides the ability to build monitor check routines based on WMI. ActiveXperts has collected more than a hundred WMI samples. You can use these samples as a base for new check routines you can write yourself. The MSAD WMI class can be used in ActiveXperts Network Monitor to monitor your servers.


Sample Code

Set objWMIService = GetObject("winmgmts:\\.\root\MicrosoftActiveDirectory")

Set colItems = objWMIService.ExecQuery("Select * From MSAD_DomainController")

For Each objItem in colItems
	WScript.Echo "CommonName:" & objItem.CommonName
	WScript.Echo "DistinguishedName:" & objItem.DistinguishedName
	WScript.Echo "IsAdvertisingToLocator:" & objItem.IsAdvertisingToLocator
	WScript.Echo "IsGC:" & objItem.IsGC
	WScript.Echo "IsNextRIDPoolAvailable:" & objItem.IsNextRIDPoolAvailable
	WScript.Echo "IsRegisteredInDNS:" & objItem.IsRegisteredInDNS
	WScript.Echo "IsSysVolReady:" & objItem.IsSysVolReady
	WScript.Echo "NTDsaGUID:" & objItem.NTDsaGUID
	WScript.Echo "PercentOfRIDsLeft:" & objItem.PercentOfRIDsLeft
	WScript.Echo "SiteName:" & objItem.SiteName
	WScript.Echo "TimeOfOldestReplAdd:" & objItem.TimeOfOldestReplAdd
	WScript.Echo "TimeOfOldestReplDel:" & objItem.TimeOfOldestReplDel
	WScript.Echo "TimeOfOldestReplMod:" & objItem.TimeOfOldestReplMod
	WScript.Echo "TimeOfOldestReplSync:" & objItem.TimeOfOldestReplSync
	WScript.Echo "TimeOfOldestReplUpdRefs:" & objItem.TimeOfOldestReplUpdRefs
	WScript.Echo ""
	WScript.Echo "########"
	WScript.Echo ""
Next