By David Wiseman (Administrator)Created 23 Feb 2008
My Rating:
Not Rated

List Domain Information using WMI

Language:  VBScript


Windows XP Yes Windows 2003 Yes
Windows 2000 No Windows NT No
Vista Unknown Windows 2008 Unknown

Retrieves information about domains discovered on the network.


Line Numbers: On  Off      Plain Text
On Error Resume Next

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colItems = objWMIService.ExecQuery("Select * from Win32_NTDomain")

For Each objItem in colItems
    Wscript.Echo "Client Site Name: " & objItem.ClientSiteName
    Wscript.Echo "DC Site Name: " & objItem.DcSiteName
    Wscript.Echo "Description: " & objItem.Description
    Wscript.Echo "DNS Forest Name: " & objItem.DnsForestName
    Wscript.Echo "Domain Controller Address: " & _
    Wscript.Echo "Domain Controller Address Type: " & _
    Wscript.Echo "Domain Controller Name: " & objItem.DomainControllerName
    Wscript.Echo "Domain GUID: " & objItem.DomainGuid
    Wscript.Echo "Domain Name: " & objItem.DomainName
    Wscript.Echo "DS Directory Service Flag: " & objItem.DSDirectoryServiceFlag
    Wscript.Echo "DS DNS Controller Flag: " & objItem.DSDnsControllerFlag
    Wscript.Echo "DS DNS Domain Flag: " & objItem.DSDnsDomainFlag
    Wscript.Echo "DS DNS Forest Flag: " & objItem.DSDnsForestFlag
    Wscript.Echo "DS Global Catalog Flag: " & objItem.DSGlobalCatalogFlag
    Wscript.Echo "DS Kerberos Distribution Center Flag: " & _
    Wscript.Echo "DS Primary Domain Controller Flag: " & _
    Wscript.Echo "DS Time Service Flag: " & objItem.DSTimeServiceFlag
    Wscript.Echo "DS Writable Flag: " & objItem.DSWritableFlag
    Wscript.Echo "Name: " & objItem.Name
    Wscript.Echo "Primary Owner Contact: " & objItem.PrimaryOwnerContact


Got a useful script? Click here to upload!


  Post Comment
Order By:  
User Comments
Posted On: 4/2/2019 9:18:18 PM

Surge RX because they may not trigger any facet-effects. A few drugs might be surely powerful and you may notice dramatic outcomes in only some seconds, but beware of the effects. Others have said a swelling on their male organ after a couple of days of the use of and a few have pronounced vomiting, nausea and dizziness.

Posted On: 6/30/2019 10:56:19 AM

Essay writing can be tough sometimes, especially technical essays. If you feel the same too then you might need an essay writing service which understands your essay writing needs and offer with the best essay writing service at the most affordable rates. essay have is the perfect solution to all of your essay writing needs.

Posted On: 11/11/2019 2:14:42 PM

Hoverboard review and the best scooters buy here.

Posted On: 12/11/2019 6:57:25 AM

This script will only work if the OU is empty - if the ou contains users or other objects they must be deleted before this script will work. best valentines day gifts for her under $50

Posted On: 1/30/2020 4:20:19 PM

Gaming is nice choice for amusement in our unfastened time.Best game of my existence is clash of lights s4 apk .I regularly play this game this year.Because it have first rate features.

Posted On: 2/7/2020 3:22:24 PM

This code is very helpful.I tried it on my machine it works very smooth.I just love this type content. sample standard deviation calculator