Friday, 3 February 2012

Auditing Exchange UM Mailbox Recordings

I've been working on a project to implement Exchange unified messaging as part of a Lync Server 2010 deployment, replacing a Nortel PBX. Our corporate policy requires that staff record a mailbox greeting for their voicemail and their name in the corporate directory, and with the Nortel system we were able to report on both (albeit manually).

When I was asked if we could perform a similar audit of the Exchange UM mailboxes I struggled to find out if this was possible. It turns out that the undocumented Exchange Management Shell cmdlet Get-UMMailboxConfiguration can report on mailbox greetings, including which greeting is in use. I also discovered that when an Exchange UM user records their name it is stored in Active Directory in the msExchUMSpokenName attribute of the user object.

So, I created this script to gather information about the greetings and name recording and report on it. The script creates a CSV file which can be used to identify users who need to record their greetings, or could easily be modified to e-mail reminders directly to the users.

# Audit-UMMailboxes.ps1
# Script to audit Exchange Unified Messaging greetings and name recordings
# Ben Lye -

# Get all the UM mailboxes in the organisation
$UMMailboxes = Get-UMMailbox -ResultSize unlimited 

# Loop through the mailboxes
ForEach ($UMMailbox in $UMMailboxes) {
 # Print the DN of the mailbox
 # Retrieve the mailbox configuration
 $MailboxConfig = Get-UMMailboxConfiguration $UMMailbox.Identity.DistinguishedName 
 # Add the in-use greeting to the mailbox object
 $UMMailbox | Add-Member -MemberType NoteProperty -Name "Greeting" -Value $MailboxConfig.Greeting
 # Add the HasSpokenName value to the mailbox object
 $UMMailbox | Add-Member -MemberType NoteProperty -Name "HasCustomVoicemailGreeting" -Value $MailboxConfig.HasCustomVoicemailGreeting
 # Add the HasSpokenName value to the mailbox object
 $UMMailbox | Add-Member -MemberType NoteProperty -Name "HasCustomAwayGreeting" -Value $MailboxConfig.HasCustomAwayGreeting
 # Lookup the mailbox in AD using the SamAccountName
 $Searcher = New-Object DirectoryServices.DirectorySearcher([ADSI]"")
 $Searcher.Filter = "(SamAccountName=$($UMMailbox.SamAccountName))"
 $ADObject = $Searcher.FindOne()

 # Check for a value in the MsExchUMSpokenName attribute of the AD object and set a property on the mailbox object
 If ($ADObject.Properties.msexchumspokenname) {
  $UMMailbox | Add-Member -MemberType NoteProperty -Name "HasSpokenName" -Value $True
 } Else {
  $UMMailbox | Add-Member -MemberType NoteProperty -Name "HasSpokenName" -Value $False

# Write the output to the screen
$UMMailboxes | Format-Table DisplayName, PrimarySmtpAddress, Greeting, HasSpokenName, HasCustomVoicemailGreeting, HasCustomAwayGreeting

# Write the output to a CSV file
$UMMailboxes | Select-Object DisplayName, PrimarySmtpAddress, Greeting, HasSpokenName, HasCustomVoicemailGreeting, HasCustomAwayGreeting | Export-Csv -Path UMMailbox-Audit.csv -NoTypeInformation
Download Script

Previously the PBX admins would have spent hours doing manual checks of recordings; this simple script means that they no longer have to spend any time at all on this task.

- Ben


  1. Get-UMMailboxConfiguration doesn't appear to be valid on my Exchange 2010 server :-(

  2. Hi Tobie,

    What version of Exchange 2010 are you running?

    I'm able to use the cmdlet on Exchange 2010 SP1 with Update Rollup 5. The lack of documentation makes me think that it's either very new, or being deprecated. If it goes away in SP2 I'll have to find a new way to do the auditing :-(


  3. Hi Ben,

    Sorry to be the bearer of bad news - this is on SP2.


  4. Hi Tobie,

    Hmm, I just upgraded my test environment to SP2 and I can still use the Get-UMMailboxConfiguration cmdlet:

    [PS] C:\Windows\system32>Get-UMMailboxConfiguration blye
    RunspaceId : 871a724a-6b8f-42d6-b86c-22ad38bc3de4
    Greeting : Voicemail
    HasCustomVoicemailGreeting : False
    HasCustomAwayGreeting : False
    Identity :
    IsValid : True

    My environment started at RTM and was upgraded to SP1 and SP2, was your environment installed as SP2 or upgaded from an earlier version?

    One other thing - the Get-UMMailboxConfiguration cmdlet is assigned to the RBAC role 'View-Only Recipients' - are you a member of that role group?


  5. Morning Ben,

    Running it with my username gives the following:

    [PS] C:\Windows\system32>Get-UMMailboxConfiguration tfysh
    The term 'Get-UMMailboxConfiguration' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
    At line:1 char:27
    + Get-UMMailboxConfiguration <<<< tfysh
    + CategoryInfo : ObjectNotFound: (Get-UMMailboxConfiguration:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

    My environment was built from the SP2 download

    I'm a member of "Exchange Organization Administrators" & "Exchange View-Only Administrators" which gives me "View-Only Recipients"



  6. We are in the same boat as you, trying to determine who has recorded a greeting. We started installing Exchange 2010 with SP1 and don't have the 'Get-UMMailboxConfiguration' cmdlet. I am waiting to hear back from Microsoft support about its availability post RTM.

  7. The code for Get-UMMailboxConfiguration is still in SP1 and SP2, but SP1/SP2 setup is not creating the Role Entry object in Active Directory. We just need to add that entry.

    1) Launch ADSIEdit, and traverse your way down to the following object:

    CN=View-Only Recipients,CN=Roles,CN=RBAC,CN=,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=,DC=

    2) Access the properties of the View-Only Recipients role object. Highlight the msExchRoleEntries property, and select Edit. Paste in the following text, select Add, OK, and OK.


    3) After giving time for AD replication to propagate the change, launch the Exchange Management Shell, and confirm the existence of the cmdlet. If the shell is already open, you’ll need to launch a new instance.

    1. Correction on that ADSIEdit path....
      CN=View-Only Recipients,CN=Roles,CN=RBAC,CN=orgname,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=domain,DC=domain

    2. That's a great find, thanks for sharing it.

      - Ben

  8. That's worked brilliantly, thanks for finding the root cause.

  9. This comment has been removed by a blog administrator.

  10. Hi Ben,
    The property HasCustomVoicemailGreeting is missing in Exchange 2013. Is there another way to report on users not having a custom greeting in exchange 2013?

    1. HI Ulrik,

      Check out the new Exchange 2013 version of the script here:

      - Ben


Note: only a member of this blog may post a comment.