Is there any way to get list of all local user accounts on a remote computer via Powershell?
You can get this with a WMI-query.
function Get-LocalUser ($Computername = $env:COMPUTERNAME) {
Get-WmiObject -Query "Select * from Win32_UserAccount Where LocalAccount = 'True'" -ComputerName $ComputerName |
Select-Object -ExpandProperty Name
}
Get-LocalUser -ComputerName "TestPC1"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With