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)
Please log in to answer
Posted by:
chucksteel
7 years ago
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