Powershell Script List All Local User Accounts on windows operating system and get the report in an excel CSV file to work further.
Every system administrator must keep track of all local user accounts on the windows machines, or windows servers to manage the infrastructure. These local system accounts have administrative privileges meaning they may part of active directory groups.
Local accounts and active directory are placed on the servers to perform admin tasks like installing the applications, GPO changes, configuration changes and more.
If you want to list out all the local user accounts on the remote computer and export results to a CSV file then below Powershell script can help you out.
When you have a requirement to Copy files on multiple remote machines, then we need to write the script this way.
We need to create a file for storing all the servers or multiple machines list, I named it as Allservers.txt for and saved it in my local machine c:\temp\Allservers.txt
$Allserers = get-content -path "C:\temp\Allservers.txt" Get-WmiObject -ComputerName $allservers -Class Win32_UserAccount -Filter "LocalAccount='True'" | Select PSComputername, Name, Status, Disabled,Lockout, PasswordRequired, PasswordChangeable | Export-csv C:\temp\local_users.csv -NoTypeInformation
Here is the output of this script.
Thank you for reading this article, if you have any questions please let us know.
Thank you for visiting my site, for any scripts in these articles you are testing please make sure you have tested this script in our lower environment before you run in production.
Leave a Reply Cancel reply