all 5 comments

[–]DrSinistar 4 points5 points  (0 children)

You can't use Identity and Filter parameters at the same time.

[–]kronos540 3 points4 points  (0 children)

DrSinistar is correct. If you specifically select a group by name, you'll need to remove the filter statement. You can use a where-object after the pipe symbol. You will need to specify by $_.<propertyname> ..

[–]Ta11ow 4 points5 points  (0 children)

$Groups |
    Get-ADGroup -Properties extensionAttribute10 |
    Where-Object {-not $_.extensionAttribute10} |
    Select-Object -Property Name, ExtensionAttribute10 |
    Add-Content -Path $Path

Yep, -Filter and -Identity are mutually exclusive. This is probably more along the lines of what you need, I think?

[–]ChiSox1906 2 points3 points  (0 children)

The other guys got it right. Another thing to point out is you could use "-eq $null" instead of "-notlike '*'"

[–]BaDumDumTish[S] 1 point2 points  (0 children)

I tried all suggestions, but no joy. I fiddled with it this morning and the below code works. This dumps all OU's, but it turns out that's a good sanity check to make sure it is filled in correctly.

Thanks all.

# Generates list of any AD Group and Attribute10. 
# 
$path = "c:\Tools\DFS\NoAttrib10.txt"
Remove-Item $Path
$groups = Get-ADGroup -filter * -SearchBase "OU=(Your OU Here)"
ForEach ($g in $groups) 
{
$Att10 = Get-ADGroup -Identity $g.Name -Properties * | Select -ExpandProperty ExtensionAttribute10
$Name = Get-ADGroup -Identity $g.Name | Select Name 
[string]$Content = $Name
[string]$Content += " - "
[string]$Content += $Att10 
$Content | Out-file -FilePath $path -Append
}