• Home
  • Topics
    • Office 365
    • Teams
    • SharePoint Online
    • Exchange 2019
    • Exchange 2016
    • Exchange 2013
    • Hybrid
    • Certificates
    • PowerShell
    • Migration
    • Security
    • Azure
  • Blog
  • Podcast
  • Webinars
  • Books
  • About
  • Videos
    • Interview Videos
    • How To Guide Videos
  • Subscribe
    • Facebook
    • Twitter
    • RSS
    • YouTube

Practical 365

You are here: Home / Exchange Server / Output a List of In-Policy Users for a Resource Mailbox Using PowerShell

Output a List of In-Policy Users for a Resource Mailbox Using PowerShell

April 20, 2014 by Paul Cunningham 36 Comments

Ricky asks:

How do you export a copy of the list of users in the resource in policy tab?

What Ricky is referring to are calendar processing settings, often used on room and equipment mailboxes, that can be used to control who can do such things as make booking requests for a meeting room.

For example, this meeting room has a list of users who are allowed to submit in-policy requests that will be automatically approved.

exchange-inpolicy-requests

We can use Get-CalendarProcessing to query the setting with the Exchange Management Shell.

1
2
3
4
[PS] C:\>Get-CalendarProcessing "HO Meeting Room 1" | fl bookinpolicy
 
BookInPolicy : {exchangeserverpro.net/Company/Head Office/Users/Aleisha.Harrison, exchangeserverpro.net/Company/Head Of
               fice/Users/David.Gower, exchangeserverpro.net/Company/Head Office/Users/Fran.Durrant}


The formatting of that output is not very useful though, if we’re trying to export a list of the users.

Instead, we can pipe to Select-Object.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
[PS] C:\>Get-CalendarProcessing "HO Meeting Room 1" | Select-Object -ExpandProperty:bookinpolicy
 
IsDeleted         : False
Rdn               : CN=Aleisha.Harrison
Parent            : exchangeserverpro.net/Company/Head Office/Users
Depth             : 5
DistinguishedName : CN=Aleisha.Harrison,OU=Users,OU=Head Office,OU=Company,DC=exchangeserverpro,DC=net
IsRelativeDn      : False
DomainId          : exchangeserverpro.net
ObjectGuid        : 9d3378be-7985-4932-b580-fe3057f00a6b
Name              : Aleisha.Harrison
 
IsDeleted         : False
Rdn               : CN=David.Gower
Parent            : exchangeserverpro.net/Company/Head Office/Users
Depth             : 5
DistinguishedName : CN=David.Gower,OU=Users,OU=Head Office,OU=Company,DC=exchangeserverpro,DC=net
IsRelativeDn      : False
DomainId          : exchangeserverpro.net
ObjectGuid        : 8a37caa8-cbfe-4c9c-92ff-40d44b4890df
Name              : David.Gower
 
IsDeleted         : False
Rdn               : CN=Fran.Durrant
Parent            : exchangeserverpro.net/Company/Head Office/Users
Depth             : 5
DistinguishedName : CN=Fran.Durrant,OU=Users,OU=Head Office,OU=Company,DC=exchangeserverpro,DC=net
IsRelativeDn      : False
DomainId          : exchangeserverpro.net
ObjectGuid        : c2516789-67cf-48b0-9cb0-fa02eb541ca8
Name              : Fran.Durrant


Still, that is more output than we really want in this situation. So instead I would run this command to see a nice, neat list of the users.

1
2
3
4
5
6
7
[PS] C:\>Get-CalendarProcessing "HO Meeting Room 1" | Select-Object -ExpandProperty:bookinpolicy | Select Name
 
Name
----
Aleisha.Harrison
David.Gower
Fran.Durrant

Exchange Server Exchange 2010, Exchange 2013, PowerShell, Resource Mailboxes, Room Mailboxes

Comments

  1. dp says

    November 5, 2019 at 11:37 pm

    $resourceIdentity = “YourResuorceMailboxEmailAddress”
    try
    {
    (Get-CalendarProcessing -Identity $resourceIdentity).Bookinpolicy | Get-user -ErrorAction SilentlyContinue | ft -AutoSize
    }
    finally
    {
    (Get-CalendarProcessing -Identity $resourceIdentity).Bookinpolicy | Get-Group -ErrorAction SilentlyContinue | select name,recipienttype | ft
    }

    Reply
    • Michel Van Delden says

      March 12, 2020 at 8:18 pm

      Thanks for you comment that was exactly what I was looking for.
      I personally was only curious about actual users so I expanded on your group output.

      $resourceIdentity = Read-Host
      try
      {
      (Get-CalendarProcessing -Identity $resourceIdentity).Bookinpolicy | Get-user -ErrorAction SilentlyContinue | ft name -AutoSize
      }
      finally
      {
      (Get-CalendarProcessing -Identity $resourceIdentity).Bookinpolicy | Get-Group -ErrorAction SilentlyContinue |% {Get-DistributionGroupMember $_.identity}| select name | ft
      }

      Reply
  2. Emily says

    October 5, 2017 at 2:13 am

    First of all, thank you! This is very informational and does, for the most part, get me what I need.

    However, piping Select Name produces a list of nothing for me. Just 7 rows of blank (like the field is blank on the user record or something). Without that, I do get the correct results, they’re just ugly and using format-list doesn’t change how it is shown. I also tried Alias and DisplayName (instead of Name along with Select) but received the same results. We are using O365 hybrid. Any ideas?

    Reply
    • Paul Cunningham says

      October 6, 2017 at 2:01 pm

      Are you running the command in the Exchange Management Shell?

      Reply
      • Emily says

        October 11, 2017 at 4:29 am

        I’m using Azure AD Powershell connecting to O365. EMS run from the on prem Exchange server cannot see the resources since they no longer live there.

        Reply
        • Paul Cunningham says

          October 11, 2017 at 9:35 am

          If the mailboxes are in Exchange Online you will need to connect to Exchange Online with PowerShell, not to Azure AD.

          Reply
          • Emily says

            October 14, 2017 at 12:24 am

            I apologize that I wasn’t clear. I’m using Powershell w the Azure AD module loaded (often required for O365) to connect to Exchange Online.

  3. Greg says

    August 18, 2017 at 2:53 am

    Thanks Paul. I actually discovered (through one of your other posts) a way to get the info I needed. It’s exactly what we were looking for. Thank you again.

    Reply
    • Rhys says

      October 10, 2018 at 12:08 pm

      What was the post or command used to get this info?

      I am having the same issue with bookinpolicy returning truncated values. When I pipe this to “| Select Name” it returns blank lines.
      I checked one of the mailboxes and legacydn property has the same truncated value

      Reply
    • Ashish Bhat says

      July 23, 2019 at 11:06 am

      Would you like to share the post

      Reply
  4. Greg says

    August 12, 2017 at 1:12 am

    Tried that, here is the output. Same results, different format.

    Get-CalendarProcessing “Conf Rm (Webinar Studio)” | Select-Object -ExpandProperty:bookinpolicy | Format-List
    /o=ExchangeLabs/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=47ad2662a8ac4c80b4bacb16db1eac48-Ricky Rober
    /o=ExchangeLabs/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=25f8646437d94061999a064b308a05c0-Eric Anthon
    /o=ExchangeLabs/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=15d4db8f8cae4a11854ae881869c88e2-Bill Willia

    Reply
    • Paul Cunningham says

      August 12, 2017 at 4:42 pm

      I don’t have access to your system so its hard for me to understand what you’re asking here. What are you expecting to see? The command works fine for me and shows the legacyExchangeDn of the mailbox users who are in the Bookinpolicy for my room mailbox.

      Reply
      • Greg says

        August 14, 2017 at 10:56 pm

        I understand that. I guess I’d like to see full names, not cut off versions.

        Ricky Rober -> Ricky Roberts
        Eric Anthon -> Eric Anthony
        Bill Willia -> Bill Williams.

        I’m glad it’s working for you though.

        Reply
        • Paul Cunningham says

          August 15, 2017 at 9:50 am

          If you look at the legacydn attribute for those users, does it show the full name at the end of the string?

          Reply
          • Greg says

            August 16, 2017 at 1:36 am

            Could you advise me on how to look at the legacydn?

        • Paul Cunningham says

          August 16, 2017 at 9:04 am

          It’s a mailbox property. Get-Mailbox will show it to you.

          Reply
  5. Greg says

    August 11, 2017 at 6:08 am

    When running this my results are cut off. Any idea how this can be resolved?
    Notice the Names, Becky Jone vs Becky Jones. These are example names only.

    Get-CalendarProcessing “HO Meeting Room 1” | Select-Object -ExpandProperty:bookinpolicy

    PS C:\windows\system32> Get-CalendarProcessing “Conf Rm 3 (Webinar Studio)” | Select-Object -ExpandProperty:bookinpolicy
    /o=ExchangeLabs/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=47ad2662a8ac4c80b4bacb16db1eac48-Ricky Rober
    /o=ExchangeLabs/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=25f8646437d94061999a064b308a05c0-Eric Anthon
    /o=ExchangeLabs/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=29587308c56e4c4285cb7e00143a78fd-Becky Jone
    /o=ExchangeLabs/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=15d4db8f8cae4a11854ae881869c88e2-Bill Willia

    Reply
    • Paul Cunningham says

      August 11, 2017 at 9:16 am

      Pipe to Format-List

      e.g.

      | format-list

      Reply
  6. Shawn says

    April 4, 2017 at 12:32 am

    This works if there is only a single group assigned to bookinpolicy

    $Proxy = “x500:” + (Get-CalendarProcessing -Identity “roomname” | Select -expand BookInPolicy)
    Get-ADGroup -Filter {proxyAddresses -Like $Proxy}

    Reply
  7. Aamir says

    April 27, 2016 at 6:29 pm

    Do you have any idea how to remove one user which is added in Bookinpolicy?

    I can add one without affecting others but not able to remove.

    Reply
  8. PK says

    April 13, 2016 at 4:28 pm

    We have the same problem with Exchange 2013, been problem since CU6.
    If we add users or groups to BookInPolicy, the users and groups have the the booking rights but when we try to check value of BookInPolicy, Select-Object -ExpandProperty:bookinpolicy or Select-Object -ExpandProperty bookinpolicy returns nothing. To mix things a little more, all users/groups that were assigned prior CU6 shows up in the BookInPolicy but users and groups that were added after CU6 was installed doesn’t.

    Reply
    • Paul Cunningham says

      April 13, 2016 at 9:37 pm

      If you think it’s a bug and you can repro it on the latest CU, open a Microsoft case and see if they can get it fixed for you.

      Reply
      • PK says

        April 14, 2016 at 5:33 pm

        We still have this problem in CU12. BookInPolicy stays empty (ie returns nothing with expandproperty) but users/groups that are added will have the proper rights. Checking who has the rights is p.i.t.a.

        Reply
        • Bryan Siler says

          November 30, 2016 at 4:50 am

          Have you found a solution to this? Having the same issue, cannot audit for rights to bookinpolicy or requestoutofpolicy. on CU13

          Reply
          • Kelvin Ryan says

            July 14, 2017 at 3:57 pm

            Hello, also encountered this issue. May I know if this has been fixed?

  9. Koen says

    March 23, 2016 at 11:21 pm

    dear,

    I’ve been trying your approach yet, it only works when the bookinpolicy had users assigned to it. When a group is assigned, I seem to be unable to retrieve the correct groupname.
    can you please assist me?

    rgd

    K.

    Reply
  10. Rikard Strand says

    January 21, 2016 at 7:29 pm

    I did not get it to work either. But this did it for me (extracting Alias):
    foreach ( $x in (Get-CalendarProcessing “*room*” | Select-Object -ExpandProperty:bookinpolicy) ) { get-mailbox $x | select -ExpandProperty:alias }

    Reply
    • Chris P says

      January 10, 2019 at 1:35 am

      if you do get-recipient instead of get-mailbox, you can also extract the alias if a group is assigned:

      foreach ( $x in (Get-CalendarProcessing “podcast_room_2gp-4” | Select-Object -ExpandProperty:bookinpolicy) ) { get-recipient $x | select -ExpandProperty:alias }

      Reply
      • Guillaume says

        March 16, 2019 at 1:36 am

        Great you saved my day !
        instead of alias I use DisplayName

        Reply
  11. Evan Camilleri says

    August 5, 2015 at 9:18 pm

    Have this changed?! It is not working 🙁

    Reply
    • Paul Cunningham says

      August 5, 2015 at 9:24 pm

      Try this:

      Get-CalendarProcessing “HO Meeting Room 1” | select -expandproperty:bookinpolicy

      Reply
      • Ashish Bhat says

        July 23, 2019 at 10:15 am

        Still Not Working

        Reply
        • Brijesh Choudhary says

          December 6, 2019 at 8:52 pm

          Use this.

          ((Get-calendarprocessing <>).bookinpolicy | Get-recipient ).PrimarySMTPAddress

          Example:

          ((Get-calendarprocessing H3060@mydomain.com).bookinpolicy | Get-recipient ).PrimarySMTPAddress

          Reply
          • Margaret Auld-Louie says

            January 8, 2020 at 12:28 pm

            I love that. It gives me just what I need, without chopping it off.

  12. Deanne Barton says

    May 5, 2014 at 2:10 pm

    Hi Paul

    How do you get a list of all meeting rooms that currently use the In-policy or out-policy?

    Reply
  13. Ricky O'Brien says

    April 22, 2014 at 6:02 pm

    Spot on answer Thanks 🙂

    Reply

Leave a Reply Cancel reply

You have to agree to the comment policy.

Recent Articles

  • Turn On MFA: Real-World Example of Fraud, Domain Stealing, and the Nearly Lost House Deposit
  • Changes in Microsoft 365 Apps Channels and Why You Should Care
  • A New Tool to Manage Exchange-related Attributes Without Exchange Server
  • Microsoft Launches Group Ownership Governance Policy
  • Making the Case for Identity Governance in Azure Active Directory

Copyright © 2022 Quadrotech Solutions AG · Disclosure · Privacy Policy
Alpenstrasse 15, 6304 Zug, Switzerland