最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

powershell - Get Notes field from Get-ADGroup - Stack Overflow

programmeradmin1浏览0评论

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
}

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
}
Share Improve this question edited Feb 6 at 21:02 Santiago Squarzon 60.1k5 gold badges23 silver badges51 bronze badges asked Feb 6 at 20:51 Tyson of the NorthwestTyson of the Northwest 2,1432 gold badges21 silver badges36 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

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
发布评论

评论列表(0)

  1. 暂无评论