将哈希表中的2个对象的属性转换为新的哈希表

时间:2017-10-05 21:15:55

标签: powershell hashtable

尝试将哈希表中2个对象的属性转换为新的哈希表

0

我收到以下错误

$names.add = Foreach ($A in $grps.keys) {Get-DistributionGroupMember -
Identity '$A' | select name | Group-Object -Propertyname -AsHashTable}

感谢任何帮助

1 个答案:

答案 0 :(得分:0)

$Grps = Get-DistributionGroupMember -Identity DG@company.com | select name | Group-Object -Property name -AsHashTable

$addr = $GRPS.GetEnumerator() | ForEach-Object {Get-DistributionGroupMember -Identity $_.name | select primarysmtpaddress| Group-Object -Property PRIMARYSMTPADDRESS -ashashtable }

Foreach ($A in $Addr.keys) {add-MailboxFolderPermission -id ${A}:\Calendar -user user@company.com -AccessRights limiteddetails}