I am trying to get the notes field of an AD group. However I have tried Notes
, Info
, and Description
but they all come up blank.
$OU = "OU=RRI,OU=Share Access,OU=Groups,OU=SSW,OU=Resources,DC=PSU,DC=DS,DC=PDX,DC=EDU"
# Get all groups in the OU
$groups = Get-ADGroup -Filter * -SearchBase $OU | sort Name
# Loop through each group and get its members
foreach ($group in $groups) {
$members = Get-ADGroupMember -Identity $group | Select-Object Name, SamAccountName
# Output the group name and its members
Write-Output "Group: $($group.Name)"
Write-Output "Info: $($group.Info)"
Write-Output "Notes: $($group.Notes)"
Write-Output "Description: $($group.Description)"
$members | Format-Table -AutoSize
}
Get-ADGroup
just as many of the Get-*
cmdlets from the ActiveDirectory Module will only display a subset of properties by default, in this case ADGroup
default properties would be Name
, ObjectClass
, ObjectGuid
, SamAccountName
and SID
.
If you want to retrieve more, you should use the -Properties
parameter:
$groups = Get-ADGroup -Filter * -SearchBase $OU -Properties notes, description, info |
Sort-Object Name