IT _Admin0723
asked on
Query all GPOs and Security Filtering Groups and Deny Groups
Hello there experts,
I'm trying to run a query to query all GPOs in our environment and its corresponding security filtering groups (GpoApply) plus deny apply which shows us (GpoCustom), and pipe it to an output file. I have the following but for some reason it's not filtering using the "where" parameter. Can someone please help? THank you so much!
Import-Module GroupPolicy
$perms = Foreach ($GPO in (Get-GPO -All -domain contoso.com))
{
Foreach ($Perm in (Get-GPPermissions $GPO.DisplayName -All -domain contoso.com))
{
New-Object PSObject -property @{GPO=$GPO.DisplayName;Tru stee=$Perm .Trustee.N ame;Permis sion=$Perm .Permissio n} | Where {$_.Permission -eq "GpoApply" -or "GpoCustom"}
}
$perms | Select GPO,Trustee,Permission | Format-Table -AutoSize
}
$perms | out-file c:\temp\results.txt
I'm trying to run a query to query all GPOs in our environment and its corresponding security filtering groups (GpoApply) plus deny apply which shows us (GpoCustom), and pipe it to an output file. I have the following but for some reason it's not filtering using the "where" parameter. Can someone please help? THank you so much!
Import-Module GroupPolicy
$perms = Foreach ($GPO in (Get-GPO -All -domain contoso.com))
{
Foreach ($Perm in (Get-GPPermissions $GPO.DisplayName -All -domain contoso.com))
{
New-Object PSObject -property @{GPO=$GPO.DisplayName;Tru
}
$perms | Select GPO,Trustee,Permission | Format-Table -AutoSize
}
$perms | out-file c:\temp\results.txt
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Is this script reporting something or renaming the Group Policy name & permission?
ASKER