ForEach ($strPF in $arrPFs) { $PF = Get-MailPublicFolder $strPF $PF.EmailAddresses += $arrProxySMTPs[$i] $PF | set-mailpublicfolder $i++ } value of $arrproxysmtps[$i] is simply an email address like asdf@asdf.com if i test with a normal $var with the same value it works. like $var = asdf@asdf.com $variable | get-member shows "system.string" $arrproxysmtps[$i] | get-member shows "system.string" Exception setting "EmailAddresses": "Cannot convert value "System.Object[]" to type "Microsoft.Exchange.Data.ProxyAddressCollection". Error: "Conversion from System.Management.Automation.PSObject to Microsoft.Exchange.Data.ProxyAddress has not been implemented.""
Hi I have two comments, may be one of it answers your question a) in your example the address space of the address you want to add is missing you should add: "smtp:asdf@asdf.com" b) I did the same and here is a part of my example and it works [Array]$newProxies = [Array]$newProxies + $proxy.ProxyAddressString $mailbox.EMailAddresses = $newProxies $mailbox | set-mailbox "mipbar" wrote: > ForEach ($strPF in $arrPFs) { > $PF = Get-MailPublicFolder $strPF > $PF.EmailAddresses += $arrProxySMTPs[$i] > $PF | set-mailpublicfolder > $i++ > } > > value of $arrproxysmtps[$i] is simply an email address like asdf@asdf.com > if i test with a normal $var with the same value it works. like $var = > asdf@asdf.com > > $variable | get-member shows "system.string" > $arrproxysmtps[$i] | get-member shows "system.string" > > Exception setting "EmailAddresses": "Cannot convert value "System.Object[]" > to type "Microsoft.Exchange.Data.ProxyAddressCollection". Error: "Conversion > from System.Management.Automation.PSObject to > Microsoft.Exchange.Data.ProxyAddress has not been implemented."" >
$PF.EmailAddresses += $arrProxySMTPs[$i] to $PF.EmailAddresse += [string]$arrProxySMTPs[$i] fixed it. For some reason the array value wasn't being read as a string. A get-member showed system.string but still that fixed it. <shrug> "Henry" wrote: > Hi > I have two comments, may be one of it answers your question > > a) > in your example the address space of the address you want to add is missing > you should add: "smtp:asdf@asdf.com" > > > b) > I did the same and here is a part of my example and it works > [Array]$newProxies = [Array]$newProxies + $proxy.ProxyAddressString > $mailbox.EMailAddresses = $newProxies > $mailbox | set-mailbox > > > "mipbar" wrote: > > > ForEach ($strPF in $arrPFs) { > > $PF = Get-MailPublicFolder $strPF > > $PF.EmailAddresses += $arrProxySMTPs[$i] > > $PF | set-mailpublicfolder > > $i++ > > } > > > > value of $arrproxysmtps[$i] is simply an email address like asdf@asdf.com > > if i test with a normal $var with the same value it works. like $var = > > asdf@asdf.com > > > > $variable | get-member shows "system.string" > > $arrproxysmtps[$i] | get-member shows "system.string" > > > > Exception setting "EmailAddresses": "Cannot convert value "System.Object[]" > > to type "Microsoft.Exchange.Data.ProxyAddressCollection". Error: "Conversion > > from System.Management.Automation.PSObject to > > Microsoft.Exchange.Data.ProxyAddress has not been implemented."" > >