Solved

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

Posted on 2016-10-20
8
81 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 15

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
 
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
Technology Partners: 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 15

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

Author Comment

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

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 15

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

Author Comment

by:paulfoel
ID: 41853323
Thanks guys
0

Featured Post

Independent Software Vendors: 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!

Question has a verified solution.

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

Scam emails are a huge burden for many businesses. Spotting one is not always easy. Follow our tips to identify if an email you receive is a scam.
This article will help to fix the below error for MS Exchange server 2010 I. Out Of office not working II. Certificate error "name on the security certificate is invalid or does not match the name of the site" III. Make Internal URLs and External…
In this video we show how to create an Accepted Domain 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 >> Ac…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

728 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