'Get users logins on windows server with powershell
I am creating a script to get user logins on the server.I do it through powershell and the event viewer. The problem is that the script returns the users and other "users" of the system and I only need the real users.
______
User
______
AR01
system
dvm-01
system
AR01
AR04
AR15
system
I thought about creating a condition so that it only selects users that start with AR, but I don't know how to do it.
Any ideas? Thanks!
Get-WinEvent -Computer MyServerName -FilterHashtable @{Logname='Security';ID=4624} -MaxEvents 2000|
select @{N='User';E={$_.Properties[5].Value}}, TimeCreated | export-csv -Path C:\Users\AR001\Desktop\filename.csv -NoTypeInformation
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
