-
Jul26
Script: Who’s Logged on to remote PCFiled under: Scripts;If you manage a network, you know how useful it is to be able to know who is logged on a remote machine. Here is a VB Script that will tell you exactly that!
ComputerName = InputBox("Enter the name of the computer you wish to query")
winmgmt1 = "winmgmts:{impersonationLevel=impersonate}!//"& ComputerName &""
Set UserSet = GetObject( winmgmt1 ).InstancesOf ("Win32_ComputerSystem")
for each User in UserSet
MsgBox "The user name for the specified computer is: " & User.UserName
Next.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }Copy the above code, save it as a vbs file, run it, enter the machine name, and it returns the logged on user! Simple as that! Note, you must be an administrator of the machine that you want to query.
2 Responses to “Script: Who’s Logged on to remote PC”
-
Anonymous January 3rd, 2008 at 5:04 am
Hi,
i ahve followed your instructions but when i run it it come up with an error with charcteer 24 ???
Chirs -
Dan B. January 3rd, 2008 at 4:13 pm
Thanks for pointing that out. The formating of the blog changed the script around a bit. I have fixed.
Enjoy!
Leave a Reply
You must be logged in to post a comment.













