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.

 
 
 
 
 
(0)
687 times
Add to favorites
Exchange
5/18/2017
E-mail Twitter del.icio.us Digg Facebook
Sign in to ask a question


  • Exchange 2010 SP3
    8 Posts | Last post November 13, 2017
    • Hi Nuno,
      
      Great script, just what i'm needing for a requested report. Question any idea why it's failing for me in Exchange 2010 SP3?? i have Reviewer & Full access assigned on the MeetingRoom
      
      VERBOSE: Loading EWS Managed API
      VERBOSE: Creating Exchange Service Object using AutoDiscover
      VERBOSE: Binding to the meetingroom@emailaddress.com Calendar folder.
      VERBOSE: Unable to connect to meetingroom@emailaddress.com. Please check permissions: Exception calling "Bind" with "2"
      argument(s): "Exchange Server doesn't support the requested version.". Skipping meetingroom@emailaddress.com.
    • Hi Jabarca,
      
      Excellent, glad the script helps!    :)
      Did you update the following line to Exchange2010_SP3?
      
      $service = New-Object Microsoft.Exchange.WebServices.Data.ExchangeService([Microsoft.Exchange.WebServices.Data.ExchangeVersion]::Exchange2013_SP1)
      
      Regards,
      Nuno
    • Hi,
      
      yes i did. this is like it looks like
      
      $service = New-Object Microsoft.Exchange.WebServices.Data.ExchangeService([Microsoft.Exchange.WebServices.Data.ExchangeVersion]::Exchange2010_SP3)
      
      tried another Meeting Room without assigning permissions and the issue is the same, so it's not related to permissions.
      
      Any help would be great
      
      cheers,
    • Hey Jabarca, I have run the string and when you put Exchange2010_SP3 it will use the Exchange2013 setting.
      
      Change it to Exchange2010_SP2 and it will work fine.  I have written other scripts with the same issue...
      
      Craig.
    • Hey Craig,
      
      thanks for the input however it did not work for me. take a look at below details after changing the string...
      
      any advise would be very welcome!
      
      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 meetingroom@emailaddress.com Calendar folder.
      VERBOSE: Unable to retrieve data from meetingroom@emailaddress.com calendar. Please check permissions: Cannot convert
      argument "0", with value: "Microsoft.Exchange.WebServices.Data.Appointment
      Microsoft.Exchange.WebServices.Data.Appointment Microsoft.Exchange.WebServices.Data.Appointment
      Microsoft.Exchange.WebServices.Data.Appointment Microsoft.Exchange.WebServices.Data.Appointment
      Microsoft.Exchange.WebServices.Data.Appointment", for "LoadPropertiesForItems" to type
      "System.Collections.Generic.IEnumerable`1[Microsoft.Exchange.WebServices.Data.Item]": "Cannot convert the
      "Microsoft.Exchange.WebServices.Data.FindItemsResults`1[Microsoft.Exchange.WebServices.Data.Appointment]" value of type
       "Microsoft.Exchange.WebServices.Data.FindItemsResults`1[[Microsoft.Exchange.WebServices.Data.Appointment,
      Microsoft.Exchange.WebServices, Version=15.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]" to type
      "System.Collections.Generic.IEnumerable`1[Microsoft.Exchange.WebServices.Data.Item]".". Skipping
      meetingroom@emailaddress.com.
    • Does it work for any meeting room, or does it fail for all of them?
    • Hi all.
      Running into same issue.
      Wondering if anyone had better luck yet.
      "Exception calling "Bind" with "2" argument(s): "Exchange Server doesn't support the requested version"
    • I am also getting errors running this script on Exchange 2010.  
      
      .\Get-MeetingRoomStats_EWS.ps1 -RoomListSMTP "room@email.com" -From "01/01/2017" -To "01/13/2017" -Verose
      VERBOSE: Loading EWS Managed API
      VERBOSE: Creating Exchange Service Object using AutoDiscover
      VERBOSE: Binding to the room@email.com Calendar folder.
      VERBOSE: Unable to retrieve data from room@email.com calendar. Please check permissions: Cannot convert argument
       "0", with value: "Microsoft.Exchange.WebServices.Data.Appointment Microsoft.Exchange.WebServices.Data.Appointment
      Microsoft.Exchange.WebServices.Data.Appointment Microsoft.Exchange.WebServices.Data.Appointment
      Microsoft.Exchange.WebServices.Data.Appointment Microsoft.Exchange.WebServices.Data.Appointment
      Microsoft.Exchange.WebServices.Data.Appointment", for "LoadPropertiesForItems" to type
      "System.Collections.Generic.IEnumerable`1[Microsoft.Exchange.WebServices.Data.Item]": "Cannot convert the
      "Microsoft.Exchange.WebServices.Data.FindItemsResults`1[Microsoft.Exchange.WebServices.Data.Appointment]" value of type
       "Microsoft.Exchange.WebServices.Data.FindItemsResults`1[[Microsoft.Exchange.WebServices.Data.Appointment,
      Microsoft.Exchange.WebServices, Version=15.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]" to type
      "System.Collections.Generic.IEnumerable`1[Microsoft.Exchange.WebServices.Data.Item]".". Skipping room@email.com.
  • Unable to Run against Office365
    1 Posts | Last post November 02, 2017
    • I'm unable to run this against Office365. Can you please help?
      
      PS C:\Scripts> .\Get-MeetingRoomStats_EWS.ps1 -RoomListSMTP "US.CA.Plstn.RM.B1.141.Cap.14.Video@clorox.com" -From "10/01/2017" -To "11/01/2017" -Verbose
      VERBOSE: Loading EWS Managed API
      VERBOSE: Creating Exchange Service Object using AutoDiscover
      VERBOSE: Binding to the US.CA.Plstn.RM.B1.141.Cap.14.Video@clorox.com Calendar folder.
      VERBOSE: Unable to retrieve data from US.CA.Plstn.RM.B1.141.Cap.14.Video@clorox.com calendar. Please check permissions:
       Cannot convert argument "0", with value: "Microsoft.Exchange.WebServices.Data.Appointment 
      Microsoft.Exchange.WebServices.Data.Appointment Microsoft.Exchange.WebServices.Data.Appointment 
      Microsoft.Exchange.WebServices.Data.Appointment Microsoft.Exchange.WebServices.Data.Appointment 
      
      Microsoft.Exchange.WebServices.Data.Appointment Microsoft.Exchange.WebServices.Data.Appointment 
      Microsoft.Exchange.WebServices.Data.Appointment", for "LoadPropertiesForItems" to type 
      "System.Collections.Generic.IEnumerable`1[Microsoft.Exchange.WebServices.Data.Item]": "Cannot convert the 
      "Microsoft.Exchange.WebServices.Data.FindItemsResults`1[Microsoft.Exchange.WebServices.Data.Appointment]" value of type
       "Microsoft.Exchange.WebServices.Data.FindItemsResults`1[[Microsoft.Exchange.WebServices.Data.Appointment, 
      Microsoft.Exchange.WebServices, Version=15.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]" to type 
      "System.Collections.Generic.IEnumerable`1[Microsoft.Exchange.WebServices.Data.Item]".". Skipping 
  • Script still failing
    1 Posts | Last post October 26, 2017
    • Have amended all the bits for Online Tenancy ($service etc.) and still getting following error for ALL meeting rooms (have Full Access Permissions:
      
      Please check permissions: Exception calling "Bind" with "2" argument(s): "The request failed. The underlying connection was closed: An unexpected error occurred on a send.". Skipping
      
      Any help much appreciated 
      
      MTIA & Best Rgds
  • Does this work with Exchange Online?
    6 Posts | Last post August 28, 2017
    • I run the script as directed, but it returns nothing, not even an error.
    • Hi Tom,
      
      Did you use the -Verbose switch when running the script?
      
      Regards,
      Nuno
    • I don't think it works with Exchange Online, at least not with the way our autodiscover is configured.
      
      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
      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."
      At C:\Scripts\Get-MeetingRoomStats_EWS.ps1:86 char:2
      +     $service.AutodiscoverUrl($Mailbox)
      +     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
          + FullyQualifiedErrorId : AutodiscoverLocalException
      
      VERBOSE: Error conneting to Exchange Web Services (no AutoDiscover URL). Exiting Script.
    • Hi Tom,
      
      Exchange Online works differently. Instead of using:
      $service.AutodiscoverUrl($Mailbox)
      
      Try manually specifying the URL for Exchange Online, such as:
      $service.Url = [System.URI] "https://autodiscover.outlook.com/ews/exchange.asmx"
      
      Please note that I haven't tested this script with Exchange Online!
      
      Regards,
      Nuno
    • Hi Nuno.
      
      Could you check this script with Exchange online and please let us know the exact script as we have tried all given suggestion and it still failed with as below.
      ===================
      PS D:\> .\Get-MeetingRoomStats_EWS.ps1 -Verbose
      
      cmdlet Get-MeetingRoomStats_EWS.ps1 at command pipeline position 1
      Supply values for the following parameters:
      RoomListSMTP: test@example.com
      VERBOSE: Creating Exchange Service Object using AutoDiscover
      VERBOSE: Binding to the test@example.com Calendar folder.
      VERBOSE: Unable to connect to test@example.com. Please check permissions: Exception calling "Bind" with "2"argument(s): "The specified folder could not be found in the store.". Skipping test@example.com
      
    • I am trying online and I set 
      $service.Url = [System.URI] "https://autodiscover.outlook.com/ews/exchange.asmx"
      However unable to bind
      VERBOSE: Binding to the meetingroom6@domain.com Calendar folder.
      VERBOSE: Unable to connect to meetingroom6@domain.com. Please check permissions: Exception calling "Bind" with "2" argument(s): "The request failed. Unable to connect to the remote server"
      . Skipping meetingroom6@domain.com.
      
      I have full permissions on the mailbox. Any Ideas?
  • Here is what I changed to make it work with Exchange online.
    1 Posts | Last post July 17, 2017
    • 1. Modified the Connect-Exchange function (make sure you update the admin account and password) : 
      
      # Create Exchange Service Object and set Exchange version
      	Write-Verbose "Creating Exchange Service Object using AutoDiscover"
      	$service = New-Object Microsoft.Exchange.WebServices.Data.ExchangeService([Microsoft.Exchange.WebServices.Data.ExchangeVersion]::Exchange2013_SP1)
          $service.Credentials = New-Object Microsoft.Exchange.WebServices.Data.WebCredentials -ArgumentList admin@domain.com, “Password!”
      	$service.AutodiscoverUrl('admin@domain.com', {$true})
      
      2. Modified the RoomName query (Get-ADuser is expected to fail in cloud): 
      
      RoomName		= (Get-Mailbox $room -ErrorAction SilentlyContinue).DisplayName
      
      
      Hope this help and Thank you Nuno for the great script! 
  • How to report against O365
    3 Posts | Last post July 17, 2017
    • We are in a Hybrid environment.  When I ran this script I got errors because AutoDiscovery blocked a redirection attempt.  It seems AutoDiscovery is trying to direct from the local installation to the cloud.  Any ideas on how I can modify this to bypass this error?
    • Hi Mark,
      
      Instead of using:
      $service.AutodiscoverUrl($Mailbox)
      
      Try manually specifying the URL, such as:
      $service.Url = [System.URI] "https://mail.domain.com/ews/exchange.asmx"  
      
      Regards,
      Nuno
    • Hi Nuno, 
      I tried this as we have a hybrid server with O365. I'm getting stuck at binding with a permission error. I have full access to the 2 resource mailboxes and get this back: 
      please check permissions: Exception calling "Bind" with "2" argument(s): "The response rec
      eived from the service didn't contain valid XML.". Skipping emailaddress@domain.gov.
      
      Any ideas? 
  • Is it working with Exchange 2007 SP3 ?
    2 Posts | Last post June 29, 2017
    • Hi Nuno, 
      I thinks it is not working with Exchange 2007 SP3, It keeps showing this error:
      
      PS C:\> .\Get-MeetingRoomStats_EWS.ps1  -RoomListSMTP "conf_room@litwareinc.com" -From "05/01/2017" -To "05/29/2017" -V
      erbose
      Missing expression after unary operator '-'.
      At C:\Get-MeetingRoomStats_EWS.ps1:18 char:4
      +   -  <<<< You must use the room's SMTP address;
      
      Any idea ?
      Many thanks for you help.
    • Hi Nelite,
      
      Yes, it should work with Exchange 2007 but I haven't tested it... Please update the following line to Exchange2007:
      
      $service = New-Object Microsoft.Exchange.WebServices.Data.ExchangeService([Microsoft.Exchange.WebServices.Data.ExchangeVersion]::Exchange2013_SP1)
      
      Regards,
      Nuno
  • Exchange 2007
    1 Posts | Last post May 29, 2017
    • Hi, thanks for posting the script. Is there any chance this could work with Exchange 2007 ?
  • Exchange 2007
    1 Posts | Last post May 29, 2017
    • Hi, thanks for posting the script. Is there any chance this could work with Exchange 2007 ?
  • Will this work with Exchange 2016 CU3?
    3 Posts | Last post May 25, 2017
    • Nuno, it has this version in it (Microsoft.Exchange.WebServices.Data.ExchangeVersion]::Exchange2013_SP1) will this work with Exchange 2016?
      
      Thanks and awesome script!!!! 
    • I ran a test this morning and left in the version Exchange2013_SP1. Ran it against my Exchange 2016 CU3 environment and it is working.
      
      Thanks again Nuno, this is an awesome script!!
    • Hi SSemanco,
      
      Yes, the script should work with Exchange 2010, 2013 and 2016. That variable only makes a difference in particular scenarios, but ideally you would want to set it to the correct version of Exchange you are using.
      Thank you for the feedback, glad it's useful!   :)
      
      Regards, Nuno