Sponsored Links

Login Form






Lost Password?

Syndicate

Home
List User Logged On To A Remote Computer PDF Print E-mail
User Rating: / 15
PoorBest 
Written by Cheyenne Harden   

Hey, who is logged on to the accounting computer on the third floor? Dunno?!!?
Now you don't have to wonder. This script will display the currently logged on user on a remote computer.

Copy and paste the following text into notepad and save it al LoggedOn.vbs

----------COPY EVERYTHING BELOW THIS LINE----------


On error resume next
strComputer = InputBox("Type in the name of the computer you want to query.")
    If strComputer > "" Then
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colComputer = objWMIService.ExecQuery _
("Select * from Win32_ComputerSystem")
For Each objComputer in colComputer
Wscript.Echo objComputer.UserName
Next

    Else
    Wscript.Quit
    End If

Wscript.Quit




----------COPY EVERYTHING ABOVE THIS LINE----------



PLEASE MAKE SURE NO WORD WRAPPING IS HAPPENING IN YOUR NOTEPAD!!!


*Make sure you are an administrator to run this.


This information is provided "AS IS" with no warranties expressed or implied.

Comments
Add NewSearch
Alex - IT Administrator   | 65.205.162.xxx | 29-10-2008 17:22:07
Is there a script that does the opposite? Look for a computer a particular user is logged into?
paresh - Similar code in C++?   | 149.77.175.xxx | 24-11-2008 06:30:23
Could you please tell me how to convert this code to C++. It will be really very helpful to me.

Thanks,
Paresh
Write comment
Name:
Email:
 
Website:
Title:
UBBCode:
[b] [i] [u] [url] [quote] [code] [img] 
 
 
 
Security Image
Please input the anti-spam code that you can read in the image.

Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved.

 
Tag it:
Delicious
Furl it!
Spurl
digg
YahooMyWeb
< Prev   Next >
 

Google Search

Google