远程powershell不返回嵌套属性

远程powershell不返回嵌套属性,powershell,exchange-server,Powershell,Exchange Server,我需要从远程exchange服务器获取有关公用文件夹的信息,并使用powershell。但有一个问题:远程powershell将结果对象的属性转换为字符串: $mailFolders = Invoke-Command -ConnectionUri:$uri –ConfigurationName Microsoft.Exchange -Credential:$creds -ScriptBlock { Get-MailPublicFolder "\imdev-ie-025-pf1\suble

我需要从远程exchange服务器获取有关公用文件夹的信息,并使用powershell。但有一个问题:远程powershell将结果对象的属性转换为字符串:

$mailFolders = Invoke-Command -ConnectionUri:$uri –ConfigurationName Microsoft.Exchange -Credential:$creds -ScriptBlock {
    Get-MailPublicFolder "\imdev-ie-025-pf1\sublevel1\sublevel2";
};

$mailFolders | Select -ExpandProperty EmailAddresses
此代码返回:

smtp:sublevel2@imdev-ie-025-2.com
smtp:sublevel2@imdev-ie-025.com
但是,如果我在exchange server上执行cmdlet localy,则会收到类似的结果

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
你知道如何得到完整的物体树吗?
谢谢。

$mailFolder.GetType返回什么?这似乎很奇怪,可能与远程命令返回的结果如何反序列化有关。一个简单的解决方案/解决方法是只在远程服务器上执行|选择部分。@MarkWragg,不幸的是,exchange会话受到约束,而Select命令不受约束available@MartinBrandl只是PSObject$mailFolder.GetType返回什么?这似乎很奇怪,可能与远程命令返回的结果如何反序列化有关。一个简单的解决方案/解决方法是只在远程服务器上执行| select部分。@MarkWragg,不幸的是,exchange会话受到约束,select命令不受约束available@MartinBrandl只是一个对象