Powershell to get the local computer groups and users detail

Powershell to get the local computer groups detail:

Group Detail:

for /F "delims=* tokens=1 skip=4" %i in ('net localgroup') do net localgroup %i >> c:\groups.txt

or
for /f %i in (MyComputerList.txt) do wmic /Node:%i path win32_groupuser where
(groupcomponent="win32_group.name=\"administrators\",domain=\" %i\"")



Users detail:

$computers = Get-Content -Path C:\computer.txt
Get-WmiObject -ComputerName $computers -Class Win32_UserAccount -Filter "LocalAccount='True'" |
Select PSComputername, Name, Status, Disabled, AccountType, Lockout, PasswordRequired, PasswordChangeable, SID | Export-csv C:\local_users.csv -NoTypeInformation

Comments

Popular posts from this blog

altiris software key

Service Principal Names (SPNs) SetSPN Syntax (Setspn.exe)

Troubleshooting Netlogon Error Codes