属性 将散列 table 中的 2 个对象转换为新散列 table

property's of 2 objects in a hash table into a new hash table

正在尝试将散列 table 中的 2 个对象的 属性 放入新的散列 table

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

我收到以下错误

The property 'add' cannot be found on this object. Verify that the property exists and can be set.
At line:1 char:1
+ $names.add = Foreach ($A in $grps.keys) {Get-DistributionGroupMember -Identity ' ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertyNotFound

感谢任何帮助

$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}