Skip to content

Instantly share code, notes, and snippets.

@belotn
Last active December 24, 2015 21:39
Show Gist options
  • Save belotn/6867678 to your computer and use it in GitHub Desktop.
Save belotn/6867678 to your computer and use it in GitHub Desktop.
Get require GPO Flags one liner
Get-ADOrganizationalUnit -Filter 'OU -like "*Citrix*"' -SearchBase 'dc=fabricam,dc=com' -Properties * |% { $_.gpLink -split ']' } |? { $_ -match '[0,2]$'} |% {(($_ -replace '\[','').split(';')[0]) -replace 'LDAP://',''} |% { get-adobject $_ -properties * } | sort -Unique DisplayName | select DisplayName,flags,@{N='flagsRecommended';E={if([bool]( gci "$($_.gPCFileSysPath)\User") -eq $false){if([bool](gci "$($_.gPCFileSysPath)\Machine") -eq $false){3}else{ 1}}else {if([bool](gci "$($_.gPCFileSysPath)\Machine") -eq $false){ 2}ELSE{ 0}} } }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment