Exchange Meeting Room Statistics

This script uses Exchange Web Services to connect to one or more meeting rooms and gather statistics regarding their usage between to specific dates.

 
 
 
 
 
4.5 Star
(6)
7,713 times
Add to favorites
Exchange
3/1/2020
E-mail Twitter del.icio.us Digg Facebook
  • Issue running query
    8 Posts | Last post March 14, 2020
    • First: Windows Server 2012 (not R2) Exchange 2013 CU20, on-prem, but hybrid with Office 365
      
      The specific room mailboxes I am trying to run this against are on-prem, but I will also be doing some in the future that have  been migrated to O365, the account I am running this from has full mailbox rights, per get-mailboxpermission
      
      Error below:
      
      [PS] C:\Users\exchangemig\Downloads>.\get-meetingroomstats.ps1 -RoomListSMTP "19FL-MtgRm-1921C-Sm@mydomain.org" -From 01/01/2020 -To 03/10/2020 -Verbose
      VERBOSE: Loading EWS Managed API
      VERBOSE: Loading module from path 'C:\Program Files\Microsoft\Exchange\Web
      Services\2.2\Microsoft.Exchange.WebServices.dll'.
      VERBOSE: Creating Exchange Service Object using AutoDiscover
      VERBOSE: Binding to the 19FL-MtgRm-1921C-Sm@mydomain.org Calendar folder.
      VERBOSE: Unable to connect to 19FL-MtgRm-1921C-Sm@mydomain.org. Please check permissions: Exception calling
      "Bind" with "2" argument(s): "The specified folder could not be found in the store.". Skipping
      19FL-MtgRm-1921C-Sm@mydomain.org.
    • Also, if it matters, i'm running this from a windows 10 box with the Exchange tools installed as well as the exchange managed API installed on it. I don't want to run something like this from the exchange servers themselves.
    • The script uses "Calendar" as the Exchange WellKnownFolderName, which can only be Calendar for this scenario! So you should never get that error... Maybe a stupid question, but is everything OK with that room's calendar? On the same line of code, please change "$_.Exception.Message" to just "$_" or "$_.Exception" and see if that gives you more information regarding the error.
      
      When you want to run this against meeting rooms in Exchange Online, please use this script instead: https://gallery.technet.microsoft.com/scriptcenter/Exchange-Online-Meeting-4894b38f
    • Thank you for responding, this is happening when I run it against any on-prem calendar
    • Ok, i figured out the issue. It's working now. 
    • Actually i'm still getting this error on a LOT of rooms... like I said, permissions is not the issue: 
      
      I'm getting this with more than half of my rooms. ALL are on-prem, and i have no reason to believe they have modified any of the default calendar settings
      
      VERBOSE: Loading EWS Managed API
      VERBOSE: Creating Exchange Service Object using AutoDiscover
      VERBOSE: Binding to the 23FL-ConfRm-Sm@mydomain.org Calendar folder.
      VERBOSE: Unable to connect to 23FL-ConfRm-Sm@mydomain.org. Please check permissions: Exception calling "Bind" with "2" argument(s): "The
      specified folder could not be found in the store.". Skipping 23FL-ConfRm-Sm@mydomain.org.
    • So it works for some but not other rooms? Any difference between them you can think of?
    • It works for about 30% of the rooms, no rhyme or reason
  • Question about running against all room mailboxes
    3 Posts | Last post March 13, 2020
    • Is there an easy way to run this across all room mailboxes? The script does not seem to like to use a variable for input.
      
      I was doing 
      $rooms = get-mailbox -recipienttypedetails roommailbox -resultsize unlimited
      get-meetingroomstats.ps1 -RoomListSMTP "$rooms@mydomain.org" -From 01/01/2019 -To 03/10/2020
      
      Also, get-meetingroomstats.ps1 -RoomListSMTP $rooms -From 01/01/2019 -To 03/10/2020
      
      Didn't work either
    • I also tried dumping all room mailboxes UPN to a csv, then using that as input, and that did not work either: 
      
      $rooms = Import-Csv C:\temp\roominput.csv
      get-meetingroomstats.ps1 -RoomListSMTP rooms -From 03/10/2019 -To 03/11/2020 -Verbose
      VERBOSE: Loading EWS Managed API
      VERBOSE: Creating Exchange Service Object using AutoDiscover
      Exception calling "AutodiscoverUrl" with "1" argument(s): "The e-mail address is formed incorrectly."
      At C:\Users\exchangemig\Downloads\Get-MeetingRoomStats.ps1:105 char:3
      +         $service.AutodiscoverUrl($Mailbox)
      +         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
          + FullyQualifiedErrorId : FormatException
      
      VERBOSE: Error conneting to Exchange Web Services (no AutoDiscover URL). Exiting Script.
    • I'm afraid not... I'd need to change the script to cater for those scenarios. It shouldn't be hard though! But now I'm focusing my efforts on the Graph API version to be honest...
  • Walk through running script from computer
    3 Posts | Last post March 01, 2020
    • When I run the script and put in the smtp of the room (ex.. room1@test.com -ExchangeOnline) because its Office365, the script just closes and I get no results. What am I missing?
    • How exactly are you calling the script? Also, have you tried with the "-Verbose" switch?
    • I have finally written a newer version, specifically target at Exchange Online only, this time using Graph API! Please try it here: https://gallery.technet.microsoft.com/scriptcenter/Exchange-Online-Meeting-4894b38f
  • Binding Error
    10 Posts | Last post March 01, 2020
    • Hi Nuno,
      
      Thank you for this script!
      
      I tried running this but i have been getting an error "Unable to connect to xyz@domain.com. Please check permissions: Exception calling "Bind" with "2"
      argument(s): "The request failed. The remote server returned an error: (401) Unauthorized.". Skipping xyz@domain.com"
      
      I have Hybrid environment and have full access on mailbox and Reviewer access on Calendar.Also i am a Global Admin on this tenant, but unable to resolve this issue of permission.
    • Hi MeaSri,
      
      Where is that particular meeting room located (on-prem or Exchange Online)? Where is the script connecting to (AutoDiscover)?
      
      Regards,
      Nuno
    • Hi Nuno,
      
      The meeting room is located on Exchange Online and script is "https://outlook.office365.com/EWS/Exchange.asmx"
      
      Do i need to make any changes in the script?
      
      Thank you,
      Mea
    • Hi Nuno,
      
      Can you check this as it is urgent and we don't have any other way to do this :)
      
      Thank you,
      Mea
    • Hi, I had the same error. The cause was MFA. Since you are Global Admin for tenant then MFA most likely is enabled by default. 
    • I have the same error. Hybrid Ex2016 on prem. Also a global admin in EXO.
      
      VERBOSE: Binding to the <mailbox> Calendar folder.
      VERBOSE: Unable to connect to <mailbox>. Please check permissions: Cannot find an overload for "Bind" and the argument count: "2".. Skipping <mailbox>.
      
      I granted FullAccess to my Global Admin account to the room mailbox.
    • Hi RhuntMT,
      
      Have you tested using OWA or Outlook to ensure your account does indeed have permissions to the mailbox? Reviewer rights to the Calendar will also work.
      Is the script connecting to the on-prem Exchange or Exchange Online?
      
      Regards,
      Nuno
    • Hi Nuno
      
      I am facing the same error. So, could you please answer on this. 
      
      Thanks.
    • Hi all, I had the same problem as MeaSri: "The request failed. The remote server returned an error: (401) Unauthorized." I was connecting with a Global Admin account with Full access to the room mailbox, BUT only with a Shared Mailbox with no license. If I tried with my regular user account with a regular mailbox with an O365 license, I was successful! :-) Hope this can help someone else!
    • I have finally written a newer version, specifically target at Exchange Online only, this time using Graph API! Please try it here: https://gallery.technet.microsoft.com/scriptcenter/Exchange-Online-Meeting-4894b38f
  • overload for "Bind"
    2 Posts | Last post March 01, 2020
    • Hi Nuno, 
      On premise, Exchange 2016. We do have Exchange Hybrid setup, but still everythign is on premise for the moment. 
      Autodiscover is set up and working for Outlook just fine. 
      do also have Office 365 Hybrid mode set up, but not currently using it. Running your script gives the following error:
      [PS] D:\Scripts>.\Get-MeetingRoomStats.ps1 -RoomListSMTP "someroomsmtp@domain.com" -From "01/01/2020" -To "01/04/2020" -Verbose
      VERBOSE: Loading EWS Managed API
      VERBOSE: Creating Exchange Service Object using AutoDiscover
      Exception calling "AutodiscoverUrl" with "1" argument(s): "The Autodiscover service returned an error."
      At D:\Scripts\Get-MeetingRoomStats.ps1:105 char:3
      +         $service.AutodiscoverUrl($Mailbox)
      +         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
          + FullyQualifiedErrorId : AutodiscoverRemoteException
      Did try the -ExchangeOnline switch just in case (no joy)
      Added my own service.Url to our internal autodiscover (no joy)
      Then, made sure the ExchangeOnline If statement is false by adding one s I seem to be getting closer...
       If ($ExchangeOnlines) { 
      With those changes now I'm getting the following error, even though i have FULL delegate rights to the calendar. Any help appreciated!
      [PS] D:\Scripts>.\Get-MeetingRoomStats.ps1 -RoomListSMTP "ConferenceRoom3B@eatonvance.com" -From "01/01/2020" -To "01/04/2020" -Verbose
      VERBOSE: Loading EWS Managed API
      VERBOSE: Creating Exchange Service Object using AutoDiscover
      VERBOSE: Binding to the ConferenceRoom3B@eatonvance.com Calendar folder.
      VERBOSE: Unable to connect to ConferenceRoom3B@eatonvance.com. Please check permissions: Cannot find an overload for "Bind" and the argument count: "2"..
      Skipping ConferenceRoom3B@eatonvance.com.
      
    • Hi Chuck,
      
      What did you update service.Url to?
  • Export results to CSV
    2 Posts | Last post February 26, 2020
    • Hi Nuno Motus, Great Script. I am new to PS. Where or rather hoe to I export the result to CSV. When I look online seems complicated but due to your script being long not sure where to put the command what needs to be in the command.
      
      Hope you able to help soon
       Thank you very much
    • Resolved it. Thanks
  • autodiscover failure
    2 Posts | Last post February 16, 2020
    • Hello and thank you for your work.
      
      I am having an issue when running this I get this following error.
      
      Exception calling "AutodiscoverUrl" with "1" argument(s): "Autodiscover blocked a potentially insecure redirection to
      https://autodiscover-s.outlook.com/autodiscover/autodiscover.xml. To allow Autodiscover to follow the redirection, use
      the AutodiscoverUrl(string, AutodiscoverRedirectionUrlValidationCallback) overload."
      
      
      
      I can not for the life of me find a way around this error. Do you have any idea what I need to change to allow the redirection?
      
      Thank you very much
    • Hi,
      
      I assume your domain is configured with a DNS CNAME record that maps autodiscover.domain.com to autodiscover-x.outlook.com? This is necessary for Outlook (and the EWS Managed API) to properly discover the Autodiscover endpoint for your domain. However, because of this CNAME, a redirection is necessary from your domain to Outlook.com. The EWS Managed API will never follow such a redirection blindly, just like your web browser wouldn't redirect to a potentially unsafe web site without asking you if you are ok with it.
      
      Are you using the -ExchangeOnline parameter when calling the script? If yes, the following line should have taken care of that issue!
      $service.Url = [System.URI] "https://outlook.office365.com/EWS/Exchange.asmx"
      
      Best regards,
      Nuno
  • What if we need get the statistics of all rooms belonging to a room list?
    2 Posts | Last post November 08, 2019
    • We have a scenario where we want this data basis roomlist locations like we have roomlist for Spain,Germany,UK and so on... what changes to be done to the script to make it work? 
      
      Please Can you help?
    • Can't you call the script multiple time, each time with the rooms for each location and exporting to a file with the location name for example? Do you have the room's location in any of the mailbox properties?
  • How will i run for all rooms in EXO
    2 Posts | Last post November 08, 2019
    • Great script. How will i make it working for all room or i can add like $room=1,2,3,4 and run like 
      
      .\Get-MeetingRoomStats.ps1 -RoomListSMTP $room -From "04/01/2019" -To "11/02/2019" -Verbose  -ExchangeOnline >>nyon.csv
      ==============================================================================
      .\Get-MeetingRoomStats.ps1 -RoomListSMTP EUNyon_Horw@domain.com -From "04/01/2019" -To "11/02/2019" -Verbose  -ExchangeOnline >>nyon.csv
    • Hi Manoj,
      
      The RoomListSMTP parameter is a string, so that method should work (although I haven't tested it). The ">> nyon.csv" at the end, when calling the script, will definitely not work. To export to CSV, just update the Export-CSV line in the script to your desired file.
      
      Regards,
      Nuno
  • Works with MFA
    3 Posts | Last post November 08, 2019
    • Hi Nuno.  Will this work with MFA?  I know my permissions are correct.  We're in hybrid mode using Exchange online.  I'm getting the same 'unauthorized' error as MeaSri.
    • Disregard.  The two things i did differently to make it work, in case anyone else runs into this, is that when i was prompted by the script to enter my credentials, i needed to enter them in the UPN format of UserID@company.com.  Previously it was entered as company\UserID.  I don't know why this matter, but i used the UPN format when connecting to Exchange Online with MFA prior to running the script, so i decided to keep it consistent.  The other item was entering the conference rooms UPN instead of it's primary smtp.  Again, not sure why this would matter, but it's working now.  :)
    • Hi Tom,
      
      Apologies for the delay in replying... Glad it is working!   :)
      
      Regards, Nuno
1 - 10 of 45 Items