arrays - Adding more than one manager of a DL -
i trying add second network user manage dl, getting error when trying append new user current one.
$group = get-distributiongroup "dl name" $list = $group.managedby $new = get-user name $list+=$new
at point want use set-distributiongroup "dl name" -managedby $list
, following error:
*method invocation failed because [microsoft.exchange.data.directory.adobjectid] doesn't contain method named 'op_addition'. @ line:1 char:8 + $list+= <<<< $new + categoryinfo : invalidoperation: (op_addition:string) [], runtimeexception + fullyqualifiederrorid : methodnotfound*
i've tried setting $list = @()
, didn't help.
thanks, jcgee
i managed achieve using add() method:
$group = get-distributiongroup "dl name" $list = $group.managedby $new = get-recipient name $list += $new.identity set-distributiongroup "dl name" -managedby $list
if $list.gettype()
find of type arraylist. if understanding correct, can't use addition operator (+) on arraylist because it's not native type.
Comments
Post a Comment