Group常见属性介绍:
一、Get-ADGroup获取群组(如下例循环获取群组的发送权限)
#群组的发送权限info $groups=Get-ADGroup -filter * -SearchScope Subtree -SearchBase "OU=xx,OU=xx,DC=xx,DC=xx,DC=xx" #获取群组名称 $export[email protected]() foreach($group in $groups) { $groupname=$group.SamAccountName $disgroup=Get-DistributionGroup -Identity $groupname $DisplayName=$disgroup.DisplayName $ou=$disgroup.OrganizationalUnit $OnlyFrom=$disgroup.AcceptMessagesOnlyFrom #循环获取拥有群组发送权限的名单 foreach($member in $OnlyFrom) { $name=$member.rdn $info=New-Object Psobject $info |Add-Member -MemberType NoteProperty -Name GroupName -Value $groupname $info |Add-Member -MemberType NoteProperty -Name DisplayName -Value $DisplayName $info |Add-Member -MemberType NoteProperty -Name ou -Value $ou $info |Add-Member -MemberType NoteProperty -Name name -Value $name $export+=$info #循环获取发送权限名单人员的信息 } } $export |Export-Csv D:\ps\groupinfol.csv -Encoding UTF8 -NoTypeInformation
时间: 2024-11-16 14:28:42