Does anybody know how I can resolve usernames to computer names through command line, or a script? If so, I'm looking to see how this works. Plus, use it to locate users.
Thanks
to get the username you really need to be the administrator of the network. When you login to the network the login can be in a remote machine or locally and you need to know what the deal is to get that info
Example: username frankrs
I can find out where this user is by doing the following:
net send frankrs "whatever" And then do a nbtstat -c to find out what machine(or IP) frankrs is logged on to.
I need something more streamline. I have a lot of users to locate. In the reverse senerio, it is easy enough, where I have the workstation and I need to see who is logged on. I can just do: nbtstat -a workstationname , and this will give me the users who are logged in. Easy enough to put in a batch file if you have a lot of workstations as well. Just do the following: for /f %a in (c:\workstaionnames.txt) do nbtstat -a %a >> c:\usernames.txt I need something like this so that I can resolve usernames to workstation names....Please help if you can...
FOR /L %i IN (1,1,254) DO nbtstat -a 192.168.0.%i>>nbtstat.txt
(1,1,254) - (start,step,end)
%i - variable.
nbtstat.txt - Resulting file.
192.168.0 - the first 3 octet of ip address, change it to you own subnet.
The 4th octet is the variable from 1 to 254 or you can limit it to any number you want.
ricpinto,
this is a great idea, but I have hundreds of subnets.
Cadaveca,
I want to be able to resolve a "username" (if they are logged in) to the workstation/IP they are logged in at, in one step. I have some "programs/tools" that do this, but I don't know how they do it, plus they are not very efficient when needing to do this for multiple users.
mmm..... I take it that you are on a windows network right ? Now, me, i'm just a linux guy, but can't you query the main login servers (PDCs, BDCs) to find out where the user is connected, and from what ip ?
I can't think of other solution yet for the meantime. Alternatively, you can put this For statement in a batch file. You can create a series of For statement according to your subnet. Just replace % with %% like:
FOR /L %%i IN (1,1,254) DO nbtstat -a 192.168.0.%%i>>nbtstat.txt
FOR /L %%i IN (1,1,254) DO nbtstat -a 192.168.3.%%i>>nbtstat.txt
FOR /L %%i IN (1,1,254) DO nbtstat -a 172.16.3.%%i>>nbtstat.txt
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.