2017-10-05 8 views
0

プロパティのハッシュテーブル内の2つのオブジェクトの新しいハッシュテーブルに

$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 
を取得

助けを歓迎します

+0

「$ names」とは何ですか?どのようにして最初にそれを作りましたか? –

+0

名前がどのように作成されたか$ names = '{ – user1959380

+0

'$ names [' add '] = foreach(...){...}' –

答えて

0
$Grps = Get-DistributionGroupMember -Identity [email protected] | 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 [email protected] -AccessRights limiteddetails} 
関連する問題