Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Find Local users on servers

$
0
0

 

 

 

 

 

 

 

 

 

All,

I'm trying to find local accounts on servers.

I have a script that pulls them in from a server listand give the server name, account name, and fullname. I would like to find a few more things about the local accout.

1. Is the account disabled

2. Is the password set to expire.

3. Add another column in the CSV stating the account is local True\false(optional)

*******************

Clear-Host

Get-Content

 

 

c:\temp\serverlist.txt | ForEach-Object {$_ get-wmiobject-class"Win32_UserAccount"-namespace"root\CIMV2"-filter"LocalAccount = True"-computername$_ }|Select-Object domain,name,fullname | Export-Csv-Append"c:\temp\localusers.csv"


Viewing all articles
Browse latest Browse all 6937

Trending Articles