Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

NBTSTAT -a <ip address>

Status
Not open for further replies.

Alcedes

Technical User
Mar 25, 2008
46
US
I know there are threads about this in other places. But I have thus far been unable to locate anything on this that is helpful for me. It is a simple sounding task I have: Column A of an Excel Spreadsheet is a list of host names. I need to ping them (done!), grab the returned ip (done!) and then NBTSTAT -A the returned IP address.

This is where I am stuck. I have tried numerous codes. None will work. And I am not able to figure out why. Due to the extreme age of the threads I found I did not want to necro one. Can anyone help me out here?



Win7x64 with Office2007
 
Sub test()

strIP = "127.0.0.1" 'This will not work. Change this to your actual IP

strCmd = "\windows\sysnative\nbtstat -a "

strFile = " > C:\Users\c895423\desktop\NBTStat.txt"

strCommand = (strCmd & strIP & strFile)

dblStatus = Shell(strCommand, vbNormalFocus)

End Sub


----------------
Only thing not working I guess is outputting it to the file. Any ideas here?
 
If you want redirection you have to use a command interpretor, eg:
strCmd = "cmd /c nbtstat -a "

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
actually i decided to use the returned IP address to connect to the remtoe host via IP and return the hostname from taht IP via WMI. no external file and no parsing. like it a lot better without the nbtstat. now if i can just figure out the Wake on LAN via WMI portion, my script will be complete.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top