Hi folks,
Just wanted to share with you a quick way to retrieve local users (whether admin or non-admin) which exist on your computer or server. I found this article which explains how to do this. Out of the methods I used WMI method and for the parameters that I was outputting were Caption, Domain (the latter should be enough), as in my report I was trying to show the computer name where I was running the code.
So my code became as below:
Get-WmiObject -Class Win32_UserAccount -Filter "LocalAccount='True'" | Select PSComputername, Name, Status, Disabled, AccountType, Lockout, PasswordRequired, PasswordChangeable, Caption, Domain
I hope you find it helpful.
Enjoy!
Just wanted to share with you a quick way to retrieve local users (whether admin or non-admin) which exist on your computer or server. I found this article which explains how to do this. Out of the methods I used WMI method and for the parameters that I was outputting were Caption, Domain (the latter should be enough), as in my report I was trying to show the computer name where I was running the code.
So my code became as below:
Get-WmiObject -Class Win32_UserAccount -Filter "LocalAccount='True'" | Select PSComputername, Name, Status, Disabled, AccountType, Lockout, PasswordRequired, PasswordChangeable, Caption, Domain
I hope you find it helpful.
Enjoy!
No comments:
Post a Comment