McLovin
asked on
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-GrantSendOnB ehalfTo @{add=$user.manager}
}
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-GrantSendOnB
}
ASKER
this is what I get when I run
Cannot process argument transformation on parameter 'GrantSendOnBehalfTo'. Cannot convert value
"System.Collections.Hashta ble" to type
"Microsoft.Exchange.Data.M ultiValued Property`1 [Microsoft .Exchange. Configurat ion.Tasks. RecipientI dParameter ]". Error:
"MultiValuedProperty collections cannot contain null values.
Parameter name: item"
+ CategoryInfo : InvalidData: (:) [Set-Mailbox], ParameterBindin...mationEx ception
+ FullyQualifiedErrorId : ParameterArgumentTransform ationError ,Set-Mailb ox
+ PSComputerName :
Cannot process argument transformation on parameter 'GrantSendOnBehalfTo'. Cannot convert value
"System.Collections.Hashta
"Microsoft.Exchange.Data.M
"MultiValuedProperty collections cannot contain null values.
Parameter name: item"
+ CategoryInfo : InvalidData: (:) [Set-Mailbox], ParameterBindin...mationEx
+ FullyQualifiedErrorId : ParameterArgumentTransform
+ PSComputerName :
How did you populate the Manager column of the .csv file?
ASKER
attached csv
ASKER
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.Hashtab le" to type
Microsoft.Exchange.Data.Mu ltiValuedP roperty`1[ Microsoft. Exchange.C onfigurati on.Tasks.R ecipientId Parameter] ". Error:
Failed to convert from System.String to Microsoft.Exchange.Configu ration.Tas ks.Recipie ntIdParame ter. Error:
arameter values of type Microsoft.Exchange.Configu ration.Tas ks.Recipie ntIdParame ter can't be empty. Specify a value
nd try again.
arameter name: identity"
+ CategoryInfo : InvalidData: (:) [Set-Mailbox], ParameterBindin...mationEx ception
cannot process argument transformation on parameter 'GrantSendOnBehalfTo'. Cannot convert value
System.Collections.Hashtab
Microsoft.Exchange.Data.Mu
Failed to convert from System.String to Microsoft.Exchange.Configu
arameter values of type Microsoft.Exchange.Configu
nd try again.
arameter name: identity"
+ CategoryInfo : InvalidData: (:) [Set-Mailbox], ParameterBindin...mationEx
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
self closed
Open in new window