During a recent migration from Exchange 2003 to Exchange 2010 we had some users complain that an old Out Of Office message had been set again on their mailbox. To check if a change was made after a migratsion, we decided to check this during the migration. I wrote a PowerShell script to check before and after to see if anything changed. Here is the code:
$rows = “User,” + “OOF State”
Add-content c:\temp\ArchiveValues.csv $rows
$userlist = import-csv c:\temp\Users-OOF.csv
foreach ($line in $userlist){
$var1a = $line.user
$mb = Get-MailboxAutoReplyConfiguration $var1a
$var1b = $mb.autoreplystate
$rowline = “$var1a,” + “$var1b”
Add-content c:\temp\OOFValues.csv $rowline
}
Basically this script reads a list of users in the CSV then runs the Get-MailboxAutoReplyConfiguration PowerShell command to see what the AutoReplyState is for each user. The script also dumps this into a CSV file to be reviewed later.
The CSV format was:
user
“Bob Smith”
“Jerry MacDonald”
“Test User”
The results look something like this:
Bob Smith,Disabled
Jerry MacDonald,Disabled
Test User,Disabled
This is just another useful little script that can be used in a pinch outside migrations.