Skip to content

Instantly share code, notes, and snippets.

@belotn
Created October 7, 2013 13:01
Show Gist options
  • Save belotn/6867616 to your computer and use it in GitHub Desktop.
Save belotn/6867616 to your computer and use it in GitHub Desktop.
Get required flag for GPO
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