This commit is contained in:
Przemyslaw Klys
2020-08-26 12:55:06 +02:00
parent 250683e830
commit 6c2e29122e
+21 -8
View File
@@ -28,15 +28,28 @@
Domain = $Domain Domain = $Domain
} }
} }
$Entries | Group-Object -Property Permission, Name, DomainName, PermissionType | ForEach-Object { $Entries | Group-Object -Property Permission, SidType, Name, DomainName, PermissionType | ForEach-Object {
$Property = $_.Name -split ', ' $Property = $_.Name -split ', '
[PSCustomObject] @{ if ($Property.Count -eq 5) {
Permission = $Property[0] [PSCustomObject] @{
Name = $Property[1] Permission = $Property[0]
DomainName = $Property[2] Type = $Property[1]
PermissionType = if ($Property[3]) { $Property[3] } else { 'Owner' } Name = $Property[2]
GPOCount = $_.Count DomainName = $Property[3]
GPONames = if ($Separator) { $_.Group.DisplayName -join $Separator } else { $_.Group.DisplayName } PermissionType = if ($Property[4]) { $Property[4] } else { 'Owner' }
GPOCount = $_.Count
GPONames = if ($Separator) { $_.Group.DisplayName -join $Separator } else { $_.Group.DisplayName }
}
} else {
[PSCustomObject] @{
Permission = $Property[0]
Type = $Property[1]
Name = ''
DomainName = $Property[2]
PermissionType = if ($Property[3]) { $Property[3] } else { 'Owner' }
GPOCount = $_.Count
GPONames = if ($Separator) { $_.Group.DisplayName -join $Separator } else { $_.Group.DisplayName }
}
} }
} }
} }