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

Comments

Please log in to comment

Answers

1
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.
Answered 02/16/2017 by: chucksteel
Red Belt

  • thanks a lot..hmm yes, i have been trying all the alternatives to get this done
Please log in to comment
Answer this question or Comment on this question for clarity
Admin Script Editor
Admin Script Editor is an integrated scripting environment available free here at ITNinja

Share