Link to home
Create AccountLog in
Avatar of Michael Leonard
Michael LeonardFlag for United States of America

asked on

Need urgent assistance with powershell script - exchange

can someone help us with this script, here is the situation, we have on premise exchange 2010 and have migrated a few hundred mailboxes to 365, this has converted the on premise mailbox, into a "remote mailbox" object.

we need to add an additional proxy address to a few hundred of these. here is the script that works fine when run against Exchange on premise mailboxes, how can we modify this to run against the "remote mailbox" object that now exists:

Import-Csv alias-add-var-gen1.csv | % {
  Get-Mailbox $_.SMTP | Set-Mailbox -emailAddresses @($user.emailAddresses)+$_.newsmtp
}

Open in new window

Avatar of FOX
FOX
Flag of United States of America image

If you are in a hybrid exchange environment and all your changes are from the on prem environment you will run the below command from on prem Exchange Management shell:


Import-Csv alias-add-var-gen1.csv | % {
  Get-RemoteMailbox $_.SMTP | Set-RemoteMailbox -emailAddresses @($user.emailAddresses)+$_.newsmtp
}
Avatar of Michael Leonard

ASKER

yes i have tried changing our script that way and using "get-remotemailbox" instead, but it generated errors.

here is the error:

Cannot process argument transformation on parameter 'EmailAddresses'. Cannot convert value "System.Collections.ArrayLis
t" to type "Microsoft.Exchange.Data.ProxyAddressCollection". Error: "MultiValuedProperty collections cannot contain nul
l values.
Parameter name: item"
    + CategoryInfo          : InvalidData: (:) [Set-RemoteMailbox], ParameterBindin...mationException
    + FullyQualifiedErrorId : ParameterArgumentTransformationError,Set-RemoteMailbox

Cannot process argument transformation on parameter 'EmailAddresses'. Cannot convert value "System.Collections.ArrayLis
t" to type "Microsoft.Exchange.Data.ProxyAddressCollection". Error: "MultiValuedProperty collections cannot contain nul
l values.
Parameter name: item"
    + CategoryInfo          : InvalidData: (:) [Set-RemoteMailbox], ParameterBindin...mationException
    + FullyQualifiedErrorId : ParameterArgumentTransformationError,Set-RemoteMailbox

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of FOX
FOX
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
thanks that worked!  appreciate it!
Nice!!