【发布时间】:2014-06-01 01:33:09
【问题描述】:
根据Technet - Add or Remove Email Addresses for a Mailbox,使用 PowerShell 控制台,以下成功从邮箱中删除了电子邮件别名:
Set-Mailbox "GenMgr" -EmailAddresses @{remove="GenMgr@domain.com"}
但是,通过远程运行空间调用下面的 PSCommand 对象会引发 System.Management.Automation.RemoteException 错误。
command.AddCommand("Set-Mailbox");
command.AddParameter("Identity", "GenMgr");
command.AddParameter("EmailAddresses", "@{remove='GenMgr@domain.com'}");
powershell.Commands = command;
powershell.Invoke();
System.Management.Automation.RemoteException:无法处理参数“EmailAddresses”的参数转换。无法将值“@{remove='GenMgr@domain.com'}”转换为类型“Microsoft.Exchange.Data.ProxyAddressCollection”。错误:“地址 '@{remove='GenMgr@domain.com'}' 无效:“@{remove='GenMgr@domain.com'}”不是有效的 SMTP 地址。域名不能包含空格,并且必须有前缀和后缀,例如 example.com。”
在我看来,问题在于 EmailAddresses 参数中的“删除”指令。
如何在 Windows 8 上使用 C# 和 PowerShell 远程运行空间让 Exchange 2010 删除电子邮件别名?
【问题讨论】:
标签: c# powershell exchangewebservices exchange-server-2010