Skip to content

Instantly share code, notes, and snippets.

@belotn
Last active December 24, 2015 16:28
Show Gist options
  • Save belotn/6827958 to your computer and use it in GitHub Desktop.
Save belotn/6827958 to your computer and use it in GitHub Desktop.
Fast Get a list of empty GPO
Get-ADObject -Filter 'ObjectClass -eq "groupPolicyContainer"' -SearchBase 'CN=Policies,CN=System,DC=fabrikam,DC=com' |% { Get-Adobject $_.distinguishedName -properties * } |?{ [bool]( gci "$($_.gPCFileSysPath)\User") -eq $false -and [bool](gci "$($_.gPCFileSysPath)\Machine") -eq $false } | select DisplayName
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment