We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

How do I find a user name who logged on to the workstation?

PeterGbiorczyk
on
Medium Priority
327 Views
Last Modified: 2012-05-06
How do I find a user name who is logged on to the workstationwith knowen Ip address and a computer name
Comment
Watch Question

CERTIFIED EXPERT
Most Valuable Expert 2019
Most Valuable Expert 2018
Commented:
Try Sysinternals PsLoggedOn (http://technet.microsoft.com/en-us/sysinternals/bb897545.aspx):
psloggedon \\ComputerName

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
PowerShell Developer
CERTIFIED EXPERT
Top Expert 2010
Commented:

There are a few different ways.

On the simple level you can connect to the Administrative share (C$), then sort the contents of "Documents and Settings" by date modified.

Or you can use WMI and get the value of UserName from Win32_ComputerSystem. VbScript and PowerShell examples of that below.

Chris
' VbScript example
strComputer = "The IP"
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
 
Set colItems = objWMIService.ExecQuery("SELECT UserName FROM Win32_ComputerSystem")
For Each objItem in colItems
  WScript.Echo objItem.UserName
Next
 
# PowerShell example
(Get-WMIObject Win32_ComputerSystem -Computer "The IP").UserName

Open in new window

Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.