Need help with powershell to set sendon behalf on mailboxes from a csv
I am needing help with setting send of behalf on a group of users the csv I have has in one column the managers which each on needs send on the behalf of the other column which is named analysts.
here is what I have so far... but not for sure how to format the add statement as to not to remove any existing users that have send aon behalf rights
$UserList = import-CSV c:\rm\sendas.csv
ForEach ($User in $UserList)
{
Set-Mailbox $user.analyst-GrantSendOnBehalfTo @{add=$user.manager}
}
this is what I get when I run
Cannot process argument transformation on parameter 'GrantSendOnBehalfTo'. Cannot convert value
"System.Collections.Hashtable" to type
"Microsoft.Exchange.Data.MultiValuedProperty`1[Microsoft.Exchange.Configuration.Tasks.RecipientIdParameter]". Error:
"MultiValuedProperty collections cannot contain null values.
Parameter name: item"
+ CategoryInfo : InvalidData: (:) [Set-Mailbox], ParameterBindin...mationException
+ FullyQualifiedErrorId : ParameterArgumentTransformationError,Set-Mailbox
+ PSComputerName :
Jason Crawford
How did you populate the Manager column of the .csv file?
OK I figured out one issue but now when I run it gets to the empty columns under managers and errors out. any ideas?
cannot process argument transformation on parameter 'GrantSendOnBehalfTo'. Cannot convert value
System.Collections.Hashtable" to type
Microsoft.Exchange.Data.MultiValuedProperty`1[Microsoft.Exchange.Configuration.Tasks.RecipientIdParameter]". Error:
Failed to convert from System.String to Microsoft.Exchange.Configuration.Tasks.RecipientIdParameter. Error:
arameter values of type Microsoft.Exchange.Configuration.Tasks.RecipientIdParameter can't be empty. Specify a value
nd try again.
arameter name: identity"
+ CategoryInfo : InvalidData: (:) [Set-Mailbox], ParameterBindin...mationException
Open in new window