我分配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