Solved

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

Posted on 2016-10-20
8
42 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
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 
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
 

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Read this checklist to learn more about the 15 things you should never include in an email signature.
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
In this video we show how to create a mailbox database 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 >> Data‚Ķ
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‚Ķ

776 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