2017-08-31 215 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