/build/static/layout/Breadcrumb_cap_w.png

count incorrect for domain users

Hi All 


Im using below two different commands to get user login count to local machine ,but every time i run the command it is showing the Domain user login count from AD
instead from LOCAL machine..i want to get the login time or count of user domain on local machine

ShellCommandTextReturn(cmd /c powershell.exe "Get-WmiObject -class Win32_NetworkLoginProfile | Where {($_.NumberOfLogons -gt 0) -and ($_.NumberOfLogons -lt 65535)} | Select-Object  Name,@{label='LastLogon';expression={$_.ConvertToDateTime($_.LastLogon)}},NumberOfLogons | Sort-Object id | Select-Object -First 1")

ShellCommandTextReturn(cmd /c wmic netlogin get Name, Numberoflogons)



0 Comments   [ + ] Show comments

Answers (1)

Posted by: chucksteel 7 years ago
Red Belt
3
You have been trying to figure out this command in several different posts, rahimpal, and it seems like it just isn't possible with PowerShell. All of the research I have done indicates that the only way to find out the number of times a user has logged into a specific computer is to search the event logs on that machine. Windows does not seem to track it any other way.

Comments:
  • thanks a lot..hmm yes, i have been trying all the alternatives to get this done - rahimpal 7 years ago

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

View more:

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ