[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2016-10-20
8
Medium Priority
?
129 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 16

Assisted Solution

by:Jason Crawford
Jason Crawford earned 1600 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
 
LVL 1

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
 
LVL 1

Author Comment

by:paulfoel
ID: 41852236
Also, forgot to say, this is to run on our old 2007 Exchange environment...
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 16

Assisted Solution

by:Jason Crawford
Jason Crawford earned 1600 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
 
LVL 1

Author Comment

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

Assisted Solution

by:Todd Nelson
Todd Nelson earned 400 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 16

Accepted Solution

by:
Jason Crawford earned 1600 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
 
LVL 1

Author Comment

by:paulfoel
ID: 41853323
Thanks guys
0

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post, I will showcase the steps for how to create groups in Office 365. Office 365 groups allow for ease of flexibility and collaboration between staff members.
This article will help to fix the below errors for MS Exchange Server 2016 I. Certificate error "name on the security certificate is invalid or does not match the name of the site" II. Out of Office not working III. Make Internal URLs and Externa…
To show how to generate a certificate request 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 Servers >> Certificates…
This video demonstrates how to sync Microsoft Exchange Public Folders with smartphones using CodeTwo Exchange Sync and Exchange ActiveSync. To learn more about CodeTwo Exchange Sync and download the free trial, go to: http://www.codetwo.com/excha…
Suggested Courses

864 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