Solved

Exchange - List users who have out of office turned on (and then disable)

Posted on 2016-10-20
8
27 Views
Last Modified: 2016-10-21
Organisation has never removed old mailboxes - just set OOO. Now they want a list of old users who are displaying OOO message (its a lot when a global email is sent).

Also, possibly to remove the message too.
0
Comment
Question by:paulfoel
  • 4
  • 3
8 Comments
 
LVL 14

Assisted Solution

by:Jason Crawford
Jason Crawford earned 400 total points
ID: 41852220
This script will disable OOF messages for all mailboxes:

foreach ($mailbox in (Get-Mailbox)) {
  foreach ($oof in (Get-MailboxAutoReplyConfiguration $mailbox.alias)) {
    if ($oof.AutoReplyState -like 'Enabled') {
      Set-MailboxAutoReplyConfiguration $mailbox.alias -AutoReplyState Disabled
    }
  }
}

Open in new window


If you want to target the script to a subset of mailboxes you can replace the (Get-Mailbox) in the first foreach loop with a .csv file containing the 'old' users.
0
 

Author Comment

by:paulfoel
ID: 41852229
Excellent. Thanks. Is there a way to display first (and maybe restrict to mailboxes on certain DBs too?)
0
 

Author Comment

by:paulfoel
ID: 41852236
Also, forgot to say, this is to run on our old 2007 Exchange environment...
0
 
LVL 14

Assisted Solution

by:Jason Crawford
Jason Crawford earned 400 total points
ID: 41852245
Here is a separate script you can run first that will generate a .csv file containing the alias and OOF state of all mailboxes on the example database DB01 that have an OOF enabled.  Replace DB01 with your actual database name.  This should run on Exchange 2007 as long as you have SP2 installed:

$results = @()

foreach ($mailbox in (Get-Mailbox -Database db01)) {
  foreach ($oof in (Get-MailboxAutoReplyConfiguration $mailbox.alias)) {
    if ($oof.AutoReplyState -like 'Enabled') {
      $object = New-Object -TypeName PSObject
      $object | Add-Member -Type NoteProperty -Name Alias -Value $mailbox.alias
      $object | Add-Member -Type NoteProperty -Name OOF_State -Value $oof.AutoReplyStatemailbox.alias
      $results += $object
    }
  }
}

$results | Select-Object alias,oof_state | Export-Csv oof.csv -NoTypeInformation

Open in new window

0
Why spend so long doing email signature updates?

Do you spend loads of your time carrying out email signature updates? Not very interesting are they? Don’t let signature updates get you down. Let Exclaimer Cloud - Signatures for Office 365 make managing email signatures a breeze.

 

Author Comment

by:paulfoel
ID: 41852287
Thanks once again. Equivalent of get-mailboxautoreplyconfiguration in Exchange 2007?
0
 
LVL 14

Assisted Solution

by:Todd Nelson
Todd Nelson earned 100 total points
ID: 41852319
Here's a simple one-liner that will output to CSV a list of those mailboxes with auto replies enabled (Exchange 2010 - 2016)...

Get-Mailbox | Get-MailboxAutoReplyConfiguration | Where-Object { $_.AutoReplyState -eq "Enabled" } | Select-Object Identity,AutoReplyState | Export-Csv "C:\AutoReplyEnabled.csv" -NoTypeInformation

Open in new window

1
 
LVL 14

Accepted Solution

by:
Jason Crawford earned 400 total points
ID: 41852536
Ha!  Good call, Todd.  I guess I was in the mood for a foreach loop for some reason.  The one-liner is much easier.

And apparently I was mistaken again with the supported Exchange version.  The Get-MailboxAutoReplyConfiguration cmdlet wasn't introduced until 2010 :(

I found this but haven't used it myself so I can't make any guarantees:

http://www.telnetport25.com/2008/12/quick-ish-tip-exchange-2007-setting-oof-for-users-via-powershell%E2%80%A6/
0
 

Author Comment

by:paulfoel
ID: 41853323
Thanks guys
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

We are happy to announce a brand new addition to our line of acclaimed email signature management products – CodeTwo Email Signatures for Office 365.
This process describes the steps required to Import and Export data from and to .pst files using Exchange 2010. We can use these steps to export data from a user to a .pst file, import data back to the same or a different user, or even import data t…
To show how to create a transport rule in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Mail Flow >> Rules tab.:  To cr…
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now