This is a simple one for today – useful for having a monitor to check for accounts that should not be there as local users.
"%windir%\System32\WindowsPowerShell\v1.0\powershell.exe" -noprofile -command "& {(Get-WmiObject -Class Win32_UserAccount -Filter \"LocalAccount='True'\" | Select -expandproperty name) -join \",\"}"
The result is a comma delimited string of local user accounts
Leave A Comment