我分配Get-Mailbox
命令给一个变量,这样我可以将此输出到一个日志文件:截断可变文本字符串
$SmtpForwardingAddress = Get-Mailbox -Identity $Upn | Select ForwardingSmtpAddress
"Email forwarding set to $($SmtpForwardingAddress)" | Tee-Object $logfilepath -Append
变量$SmtpForwardingAddress
回报:
“的电子邮件转发集到@ {ForwardingSmtpAddress = smtp:[email protected]}“
我想修剪这个只是[email protected]
值。我试了几件事情,但得到这样的错误下面:
方法调用失败,因为[Selected.System.Management.Automation.PSCustomObject]不包含名为“子”的方法。
方法调用失败,因为[Selected.System.Management.Automation.PSCustomObject]不包含名为“微调”的方法。
任何想法,我可以做什么来获得理想的结果?
'$ SmtpForwardingAddress'的输出是什么? – TheIncorrigible1
如上所示: “@ {ForwardingSmtpAddress = SMTP:[email protected]}” – jshizzle