Set-DistributionGroup : Set ManagedBy multiple users
hello, created script accept user input (for username)
the script accept 1 username @ time , combine 1 string (separated comma + space) , assign variable.
i do:
set-distributiongroup -identity testdl -managedby $ownerlist
i error:
couldn't find object "user1, user2". please make sure spelled correctly or specify different object.+ categoryinfo : notspecified: (0:int32) [set-distributiongroup], managementobjectnotfoundexception
+ fullyqualifiederrorid : 132914ad,microsoft.exchange.management.recipienttasks.setdistributiongroup
if manually type:
set-distributiongroup -identity testdl -managedby user1, user2
it works.
any ideas?
thanks!
managedby parameter accepts array of ids. therefore make change successfully:the managedby field can have multiple users. as mentioned, same line works if manually type in names.
if suggestion, make last person on list owner (because keeps replacing owner).
$ownerlist = @('owner1','owner2','owner3') set-distributiongroup -identity testdl -managedby $ownerlist mind if combine whole list 1 single string first did, command interprets 1 single object instead of array.
things same aren't necessary same.
Windows Server > Windows PowerShell
Comments
Post a Comment