Get local system users and details with PowerShell
Ok, now we are dealing with only the local users on the system.
a simpler way to get the details are by using the below one-liner.
Get-WmiObject -Class Win32_UserAccount -filter "LocalAccount = '$True'" -ComputerName localhost -Namespace "root\cimv2"
you could pipe the above one-liner to '| select *' at the end to get more details on the each account available.
Get-WmiObject -Class Win32_UserAccount -filter "LocalAccount = '$True'" -ComputerName localhost -Namespace "root\cimv2" | select *
Give a try to execute this to grab remote machine users and see how it worked or didn't work...
As always.
-Happy Scripting.
No comments:
Post a Comment