Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $accountnames=foreach( $line in (net user) -split "`n"){if($line -ne "" -and $line -notlike 'User accounts*' -and $line -notlike '---------*' -and $line -notlike 'The command completed*' ){ Write-Output $line}}
- $accountnames=$accountnames -replace("`n|`r|\s+", ",") -split(",")
- $account_localgroups=foreach($account in $accountnames){if($account -ne ""){foreach($line in (net user $account)){if($line -like "Local Group Memberships*"){write-output "$account=$line`n".replace("\s+", " ").replace("*", "").replace("Local Group Memberships", "")}}}}
- write-output $account_localgroups|ConvertFrom-StringData
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement