DarkGUNMAN Posted December 18, 2008 Posted December 18, 2008 I've made a little front-end for VNC which has input for credentials and the domain and the IP/Hostname. However, since we are migrating from several domains to one AD, I can't be sure which domain the PC is in it fi try and connect. Looking at the way you can browse a network manually through explorer and find PC in a domain without inputting any credentials, is there any way to do this through functions in AutoIT by entering a hostname or IP, and returning the domain the it is attached to? I'm guessing it is possible through the WinNet functions, but I don't know my way around them. Any help would be greatly appreciated!
99ojo Posted December 18, 2008 Posted December 18, 2008 (edited) I've made a little front-end for VNC which has input for credentials and the domain and the IP/Hostname. However, since we are migrating from several domains to one AD, I can't be sure which domain the PC is in it fi try and connect. Looking at the way you can browse a network manually through explorer and find PC in a domain without inputting any credentials, is there any way to do this through functions in AutoIT by entering a hostname or IP, and returning the domain the it is attached to? I'm guessing it is possible through the WinNet functions, but I don't know my way around them. Any help would be greatly appreciated!hi, maybe this helps you: $strComputer = "." $objWMIService = ObjGet ("winmgmts:\\" & $strComputer & "\root\cimv2") $colitem = $objWMIService.ExecQuery ("Select * From Win32_computersystem") For $compsys in $colitem MsgBox (0, "", $compsys.domain) Next In the messagebox you see the dns name of the domain. $strcomputer "." is local, else set $strcomputer "\\machinename". I couldn't figure out, but i think you must have administrative rights on the machines. Or you can use nbtstat -a machinename and work with the output. you see the netbiosname of the domain regiistered as group. ;-)) Stefan Edited December 18, 2008 by 99ojo
DarkGUNMAN Posted December 19, 2008 Author Posted December 19, 2008 (edited) hi, maybe this helps you: $strComputer = "." $objWMIService = ObjGet ("winmgmts:\\" & $strComputer & "\root\cimv2") $colitem = $objWMIService.ExecQuery ("Select * From Win32_computersystem") For $compsys in $colitem MsgBox (0, "", $compsys.domain) Next In the messagebox you see the dns name of the domain. $strcomputer "." is local, else set $strcomputer "\\machinename". I couldn't figure out, but i think you must have administrative rights on the machines. Or you can use nbtstat -a machinename and work with the output. you see the netbiosname of the domain regiistered as group. ;-)) Stefan Hi Stefan, thanks for the reply. Didn't know about that particular WMI command, but thanks for posting it as it might be useful later - can't use it here as it requires credentials. The NBTStat command is useful in returning the information i need without using credentials, it's not something i can use in an AutoIt script to return a domain value. [Edit: The wonders of searching the forum showed me a way to do this - thanks for the clue] That said - having read about it but not knowing the command sent to the dll, is there any way to do this in a similar way to _TCPIpToName through dll calls? Edited December 19, 2008 by DarkGUNMAN
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