Solved

Users logged in to computers

Posted on 2013-12-10
6
279 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 167 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 166 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 167 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
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 

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 IT Pros

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

The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
Microsoft Office 365 is a subscriptions based service which includes services like Exchange Online and Skype for business Online. These services integrate with Microsoft's online version of Active Directory called Azure Active Directory.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

636 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