2017-08-31 220 views
0

我公司目前擁有的Office 365的範圍內600個新創建的郵箱列表,但是我現在面臨的問題是,我需要爲以前的600個郵箱的新郵箱內的自動回覆很短的時間。辦公室365 - 郵箱

例如:

[email protected]將收到來自客戶的電子郵件,[email protected]將發送自動發送的電子郵件返回給客戶建議他們聯繫新的郵箱[email protected] .COM

我明白,我其實可以將電子郵件轉發到新的郵箱但是,我已經收到了規範要避免這種情況,如果可能的。

我怎麼可以使用PowerShell腳本,而無需手動更改所有郵箱自己創造的600個郵箱,我有我的XLS表格*內的自動回覆?

*在電子表格中包含兩列,列一個包含以前的郵箱地址和兩個包含新創建的郵箱地址欄

回答

0

代碼的變種下面應該工作。

# Might need to do some magic with -encoding and -delimiter below 
$Import = Import-Csv "\\server\share\mailboxes.csv" 

# Loop through all the lines in the csv 
foreach ($Line in $Import) 
{ 
# Assuming two columns, one with header "oldmailbox" and one with header "newmailbox" 
$OldMailBox = $Line.oldmailbox; $NewMailBox = $Line.newmailbox 

# Enable autoreply and set a message 
Set-MailboxAutoReplyConfiguration -Identity $OldMailBox -AutoReplyState Enabled -ExternalMessage "Send mail to $NewMailBox" 
} 

更多信息可以在這裏找到:https://technet.microsoft.com/en-us/library/dd638217(v=exchg.160).aspx

+0

很抱歉這麼晚纔回復。非常感謝你這是我一直在尋找的東西 – RazorSec