Solved

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

Posted on 2016-10-20
8
51 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 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
Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

 
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 15

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

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

This article explains in simple steps how to renew expiring Exchange Server Internal Transport Certificate.
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.
In this video we show how to create a Resource Mailbox in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: Navigate to the Recipients >> Resources tab.: "Recipients" is our default selection …
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…

856 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