We help IT Professionals succeed at work.

How can I check which activedirectory user is logged on on a remote machine ?

156 Views
Last Modified: 2017-04-12
Please advise
Comment
Watch Question

Chris DentPowerShell Developer
CERTIFIED EXPERT
Top Expert 2010

Commented:
The simplest possible way is to get WMI to tell you. Interactive users only.
(Get-CimInstance Win32_ComputerSystem -ComputerName some-remote-pc).Username

Open in new window

AlexA lack of information provides a lack of a decent solution.
CERTIFIED EXPERT

Commented:
If you want a more detailed approach

https://gallery.technet.microsoft.com/scriptcenter/Get-LastLogon-Determining-283f98ae

I've used that myself on 1000 VM desktops.
Tom CieslikIT Engineer
CERTIFIED EXPERT
Distinguished Expert 2017

Commented:
Lazy man's way to track user logon/logoff
I always like to find easy ways to do things.

Step 1: Create the following two files using Notepad or your favorite text editor:

------logon.cmd----
echo logon %username% %computername% %date% %time% >> \\SERVER\share\logon.log

-----logoff.cmd-----
echo logoff %username% %computername% %date% %time% >> \\SERVER\share\logon.log

Step 2: Update Group Policy to run the appropriate batch file. In Group Policy, go to:
User Configuration-> Windows Settings-> Scripts (Logon/Logoff)-> Logon

This will tell you about every users logon and logoff
Chris DentPowerShell Developer
CERTIFIED EXPERT
Top Expert 2010

Commented:
Tom,

You need to cite sources when you do what you've just done. It's a fine way to get yourself in trouble with the site moderators.

http://blogs.msmvps.com/kwsupport/2005/02/24/lazy-mans-way-to-track-user-logonlogoff/

It's not your work, you should not pass it off as your work.
Tom CieslikIT Engineer
CERTIFIED EXPERT
Distinguished Expert 2017

Commented:
@Chriss
I have this in my Outlook notes for Years. I've used this solution 7 years ago. I did not copied this today from any website.
I did not know that this exists in internet

Author

Commented:
I am not sure these tips wil provide me a view on who is currently logged on (if I don't know who its is)
Tom CieslikIT Engineer
CERTIFIED EXPERT
Distinguished Expert 2017

Commented:
If you will see Username with log on time and there is no Log Off time it seem he is still log on
PowerShell Developer
CERTIFIED EXPERT
Top Expert 2010
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
E ATech Lead
CERTIFIED EXPERT

Commented:
You could check the logon information in event log. Check Event viewer -->> Security events for Successfully logins. You can filter by user or Computer name to find exact time and that of logged in user.

Get in detail here to track user logon sessions using event log:
https://community.spiceworks.com/how_to/130398-how-to-track-user-logon-sessions-using-event-log

Try this:

Right click My Computer - Click Manage - Expand Shared Folders - Click Sessions

This will provide the username and the IP of the PC they are logged into

You can then go to DHCP under Administrative Tools and view the leases to see the PC name

https://social.technet.microsoft.com/Forums/windows/en-US/01eaf9dd-ac07-45bc-8d01-9fc85ba9db9f/find-computer-name-user-is-logged-onto?forum=winserverDS

https://deployhappiness.com/find-out-what-computer-a-user-logged-into/

https://social.technet.microsoft.com/Forums/office/en-US/2b6c1df1-7fdc-4e1a-9ef2-163ebc035aed/report-all-computers-and-last-logged-on-user-to-those-computers-from-active-directory?forum=winserverDS

Hope this helps!
E ATech Lead
CERTIFIED EXPERT

Commented:
Is there any update?
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*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.