Contact Info

Crumbtrail » Administration » Scripts » WMI Performance Counters » VBScript

DomainController - WMI sample in VBScript

The foundations for Manageability in Windows 2019/2012/2008/ and Windows 10/8/7/Vista/XP are 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.

On this site, you can find many WMI samples.

The DomainController WMI class can be used in ActiveXperts Network Monitor to monitor your servers.



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 ""