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!

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).


managedby parameter accepts array of ids.  therefore make change successfully:

$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

Popular posts from this blog

Group Policy Event ID 1058 Error Code 1326 (The user name or password is incorrect)

Suspicious event log Event ID: 4905

DCOM received error "2147746132" from...