Sign in to follow this  
Followers 0
DarkGUNMAN

Find the NT-Domain without using credentials?

3 posts in this topic

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!

Share this post


Link to post
Share on other sites



#2 ·  Posted (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 by 99ojo

Share this post


Link to post
Share on other sites

#3 ·  Posted (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 by DarkGUNMAN

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0