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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBScript for WIN2K to get user name

Status
Not open for further replies.

techspec35

IS-IT--Management
Jul 5, 2002
5
US
I want to write a script that will be able to tell me who is logged on to a specific machine on the network. I mainly need this because the people on our network log on to different machines, and several do not know how to find the name or ip of the machine that they are working on when they have a problem, and a script that can tell me where someone is logged on would be great!
 
you can use this:
<%
For each item in request.servervariables
response.write &quot;<b>&quot; & item & &quot;</b>: &quot;
response.write request.servervariables(item) & &quot;<br>&quot;
Next
%>
this brings back all kinds of good stuff...ip address is in there
hth
mb &quot;Where's the Ka-Boom? There's supposed to be an Earth-shattering Ka-Boom!&quot;
Marvin the Martian
 
Just a word of caution here....

I believe this only works if your web server is configured for NT authentication (clear text). I might be wrong about that, I don't have a machine available to test this on.

Also, you might be surprised to find that if you are configured for NT authentication (clear text) you will be able to see a users NT password! Probably not a desired result, and it may upset some users.

 
well i found the code that I wanted, and here it is for anyone who is interested, although it has now sparcked a new question that I will post in a new thread, thanks for the help though.

ComputerName = InputBox(&quot;Enter the name of the computer you wish to query&quot;)

winmgmt1 = &quot;winmgmts:{impersonationLevel=impersonate}!//&quot;& ComputerName &&quot;&quot;

Set UserSet = GetObject( winmgmt1 ).InstancesOf (&quot;Win32_ComputerSystem&quot;)

for each User in UserSet
MsgBox &quot;The user name for the specified computer is: &quot; & User.UserName
Next


this will prompt you for the computer's name, and tehn it will return the name of the user that is currently logged in.
 
This Was good info 'hithere ' it even works with my Xp sys.
Thank u AI
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top