Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Users logged in to computers

Posted on 2013-12-10
6
Medium Priority
?
284 Views
Last Modified: 2013-12-18
I need to query a list of computers and retrieve users that have logged in to each computer.
for instance:
computerA =User1 logged in
ComputerB=User20 logged in

it will be nice if the script can give me for instance:
computerA= user1 ,user7,user3 have logged into at separate date and time..

Thanks
0
Comment
Question by:jskfan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 3

Assisted Solution

by:JoeIronsmith
JoeIronsmith earned 668 total points
ID: 39710515
Hi,

You can add this into your user's logon script:

@echo off
echo %date% %time% Logon %UserName% %ComputerName% >> \\MyServer\MyShare\LogTimes.txt

Then you can open it via excel (open a new file / Data / From text) and filter and sort it based on what information you need, e.g. username, computer name, etc.

Cheers,
Joe
0
 
LVL 12

Assisted Solution

by:SreRaj
SreRaj earned 664 total points
ID: 39710552
Hi,

You could try the following PowerShell script from Technet Script Gallery.

http://gallery.technet.microsoft.com/scriptcenter/d46b1f3b-36a4-4a56-951b-e37815a2df0c
0
 
LVL 39

Accepted Solution

by:
Krzysztof Pytko earned 668 total points
ID: 39710763
Try to do that with free SysInternals tool called PsLoggedOn
http://technet.microsoft.com/en-us/sysinternals/bb897545.aspx

This is really easy in use tool which allows for scripting

Regards,
Krzysztof
0
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 

Author Comment

by:jskfan
ID: 39712850
PsLoggedOn tool can be used to find current logged on user to which computer.

I need the last user logged on
0
 

Author Comment

by:jskfan
ID: 39728256
this is right link:

http://www.intelliadmin.com/index.php/2012/06/find-out-who-logged-on-to-a-computer/


Set objWMIService = GetObject("winmgmts:\\Remotecomputername\root\cimv2")
 Set colItems = objWMIService.ExecQuery("Select * from Win32_NetworkLoginProfile")

For Each objItem in colItems
   
   Wscript.Echo objItem.Name
   
 Next
0
 

Author Closing Comment

by:jskfan
ID: 39728257
Thank you Guys...The script I posted did the work
0

Featured Post

Office 365 Training for Admins - 7 Day Trial

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After seeing many questions for JRNL_WRAP_ERROR for replication failure, I thought it would be useful to write this article.
Wouldn't it be nice if objects in Active Directory automatically moved into the correct Organizational Units? This is what AutoAD aims to do and as a plus, it automatically creates Sites, Subnets, and Organizational Units.
The viewer will learn how to dynamically set the form action using jQuery.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question