Added 'list-local-groups-and-users.ps1'

This commit is contained in:
Will Mellon 2023-03-15 13:31:30 -04:00
parent be45a35893
commit 8a896fc940

View file

@ -0,0 +1,11 @@
$FormatEnumerationLimit=-1
$grouplist = get-localgroup
$array = @()
foreach ($G in $grouplist){ `
$line = new-object psobject; `
$line | add-member -membertype noteproperty -Name 'Group Name' -Value $G.Name; `
$user = get-localgroupmember -name $G.Name | Select-Object -Property Name; `
$line | add-member -membertype noteproperty -Name 'User' -Value $user.Name; `
$array += $line`
}
$array | ft -wrap -autosize