?
Solved

Finding the NetBIOS computer name for a given username

Posted on 2003-03-23
12
Medium Priority
?
2,350 Views
Last Modified: 2009-12-16
I am looking for a way, either using an external program, or as part of a vbscript, to take a username and find out the NetBIOS name of the computer that the user is logged on to. I know that one can use "nbtstat" to determine what user is logged on to a given computer, but I'd like to do it the other way around, preferably without having to poll every machine on the network.

I understand that the "net send" command can take a username as the destination and somehow it finds its way to the computer to which the given user is logged on. What would be extremely helpful is either an idea for how to code this sort of function in vbscript, or even if someone knows of a program that can do this task. If there is a program that does this, then I could just save its output as a textfile and use it in the script I am writing. If you need any more info, don't hesitate to ask! Thanks :-)
0
Comment
Question by:Abyzmal
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
12 Comments
 

Expert Comment

by:Goliath_
ID: 8205144
the only easy way i see to do that, is that user login script writes the computername associate with their username into a DB or even a flat text file and then you can take a search into that from another vbscript...

thanks!
0
 
LVL 1

Expert Comment

by:BaDaBooM
ID: 8214289
This may be more involved than you want to get, but there is a tool in the Windows 2000 resource kit that can do this and even store it in a SQL database.  The name of the file is Cconnect.exe.  It can also limit concurrent connections.  Look for it in the resource kit documentation.
0
 

Author Comment

by:Abyzmal
ID: 8215105
Let's say that all the machines are connected to a Windows 2000 network server (active directory). Is there a way to poll the server to lookup the computername for a given user?

--Brandon
0
The Ideal Solution for Multi-Display Applications

Check out ATEN’s VS1912 12-Port DP Video Wall Media Player at InfoComm 2017. Kerri describes how easy it is to design creative video walls in asymmetric layouts and schedule detailed playlists ahead of time with its advanced scheduling feature.

 
LVL 1

Expert Comment

by:aded
ID: 8217626
you want a VBS script, here you are
http://www.bellamyjc.net/download/vbs/sessions.vbs
0
 

Author Comment

by:Abyzmal
ID: 8218319
I have been playing around with that script a bit. The automatic domain lookup fails, but since I am only using it on one domain I hardcoded it in. Now when I try it on the localmachine, it replies that there are no active sessions (!). When I try it on a remote machine, it fails on this line:

Set LoginProfiles = GetObject("winmgmts://" & Machine).InstancesOf("Win32_NetworkLoginProfile")

I am not sure how to fix this error. But nonetheless it seems that this script still only gives the username logged on at a given machine. What I am looking for is the reverse; a way to find the current computer given a username.
0
 
LVL 1

Expert Comment

by:aded
ID: 8218393
ok sorry wrong way
but I don't see how not to poll machines
a simple solution withe polling is a so simply
 NET SESSION \\COMPUTERNAME

logically you know all the machines of your network, so with a batch command you can do it
0
 
LVL 1

Accepted Solution

by:
bcastaldo earned 300 total points
ID: 8253635
oh boy, here goes, write it out in a script or do it out, but if this doesnt satisfy you then i dont know, 'net view > people.txt' open file do a find/replace, find '\\' replace with 'nbtstat -a ' boom. save change 'people.txt' to 'people.bat'. run it in a prompt 'people.bat > computer.txt' and do a find on the user name within that file and walla you find the computer name by user.
0
 

Author Comment

by:Abyzmal
ID: 8258712
Yes, that is a decent solution. The problem is that it connects to every machine on the network, and when you have a few hundred workstations on one network, well... Anyway, I am sure that Micro$oft's netsend uses some other way, I just dunno what it is. If no one else can provide a better solution, then I suppose I'll take that as the answer. Thanks.

--Brandon
0
 
LVL 1

Expert Comment

by:AVSEC
ID: 10577198
If you have WINS running then you can query it using WINSCL (from NT/2k reskit) to find out the computer name that a user last logged into. I wrote a vbscript ages ago that used WshShell.exec to run WINSCL, get the output, and extract the info I wanted (the computer name the user last logged in to).
0
 

Expert Comment

by:spae0022
ID: 11626784
You can use ADNM at http://www.logicdevelopment.net  It has a nice GUI and you can export the results too.
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface There are many applications where some computing systems need have their system clocks running synchronized within a small margin and eventually need to be in sync with the global time. There are different solutions for this, i.e. the W3…
Trying to figure out group policy inheritance and which settings apply where can be a chore.  Here's a very simple summary I've written which might help.  Keep in mind, this is just a high-level conceptual overview where I try to avoid getting bogge…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question