Returns local domain information.
strComputer = "."Set objWMIService = GetObject("winmgmts:" _& "{impersonationLevel=impersonate}!\\" & _strComputer & "\root\MicrosoftActiveDirectory")Set colDomainInfo = objWMIService.ExecQuery _("Select * from Microsoft_LocalDomainInfo")For each objDomain in colDomainInfoWscript.Echo "DNS name: " & objDomain.DNSNameWscript.Echo "Flat name: " & objDomain.FlatNameWscript.Echo "SID: " & objDomain.SIDWscript.Echo "Tree name: " & objDomain.TreeNameWscript.Echo "Domain controller name: " & objDomain.DCNameNext
This is a VB Script, this can be used by saving the file in .vbs file