I need to get information about public folders from a remote Exchange server and for this I use remote powershell. But there is one problem - remote powershell reduces all properties of returned objects to a string form:
$mailFolders = Invoke-Command -ConnectionUri:$uri –ConfigurationName Microsoft.Exchange -Credential:$creds -ScriptBlock { Get-MailPublicFolder "\imdev-ie-025-pf1\sublevel1\sublevel2"; }; $mailFolders | Select -ExpandProperty EmailAddresses This code will return the following:
smtp:sublevel2@imdev-ie-025-2.com smtp:sublevel2@imdev-ie-025.com But if you run this cmdlet locally on the exchange server, the result will be something like this:
Get-MailPublicFolder "\imdev-ie-025-pf1\sublevel1\sublevel2" | Select -ExpandProperty EmailAddresses SmtpAddress : sublevel2@imdev-ie-025-2.com AddressString : sublevel2@imdev-ie-025-2.com ProxyAddressString : smtp:sublevel2@imdev-ie-025-2.com Prefix : SMTP IsPrimaryAddress : False PrefixString : smtp SmtpAddress : sublevel2@imdev-ie-025.com AddressString : sublevel2@imdev-ie-025.com ProxyAddressString : smtp:sublevel2@imdev-ie-025.com Prefix : SMTP IsPrimaryAddress : False PrefixString : smtp Are there any ideas how to get objects with all values? Thank.