MSAD jscript 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
var strComputer = "."; var objWMIService = GetObject("winmgmts:\\\\" + strComputer + "\\root\\MicrosoftActiveDirectory"); var colItems = objWMIService.ExecQuery("SELECT * FROM MSAD_DomainController", "WQL"); var enumItems = new Enumerator(colItems); for (; !enumItems.atEnd(); enumItems.moveNext()) { var objItem = enumItems.item(); 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("") }