vcent Posted April 6, 2009 Posted April 6, 2009 Hi, I want to get the windows server domain. I search thr the help and got @logonDNSdomain and @logondomain However the above only gave the user login domain. What I need is the computer domain. thanks.
Danny35d Posted April 6, 2009 Posted April 6, 2009 $ComputerDomain = _DomainComputerBelongs() MsgBox(0 , @LogonDomain , 'Domain: ' & $ComputerDomain) Func _DomainComputerBelongs($strComputer = "localhost") ; Generated by AutoIt Scriptomatic $Domain = '' $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") If Not IsObj($objWMIService) Then Return SetError(1, 0, '') $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystem", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) then For $objItem In $colItems $Domain = $objItem.Domain Next Endif Return $Domain EndFunc AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
ibroadbent Posted May 16, 2011 Posted May 16, 2011 Hi,I want to get the windows server domain.I search thr the help and got @logonDNSdomain and @logondomainHowever the above only gave the user login domain.What I need is the computer domain.thanks.This will return the name of the Domain:$Domain = RegRead("HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters", "Domain")It returns null if the PC is a Workgroup member.It also reports the domain even when logging in to a local account on the PC.ibroadbent
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now