MVP - Most Valuable Professional

Just can't get enough of IT

This blog is about mostly anything in IT. But the primary focuses are Microsoft Technologies like Exchange, Office 365, Azure and Cloud Security.

Exchange Server 2013Exchange Server 2016Exchange Server 2019Description

This script gathers a list of enabled users for a selected Exchange Server client protocol. The list of users is sent by email as HTML text in the email body or as an attached CSV file. You can select to gather data for a single protocol or for all protocols.

Available protocols are:

  • POP
  • IMAP
  • ActiveSync



  • Windows Server 2012 R2 or newer
  • Exchange 2016+ Management Shell
  • GlobalFunctions module (found here)



# Find users having all protocols enabled, create a CSV file per protocol and send an email with CSV attachments

.\Get-EnabledProtocolReport.ps1 -SendMail -MailFrom -MailTo -MailServer -Protocol ALL

# Find users having all protocols enabled, create a CSV file per protocol

.\Get-EnabledProtocolReport.ps1 -Protocol ALL -ExportCsv


Version History

  • 1.0, Initial community release




Follow Me

Read More »
Last updated: 2019-09-26


Exchange Server 2007Exchange Server 2010Exchange Server 2013Exchange Server 2016Exchange Server 2019Description


This script creates an HTML report showing the following information about an Exchange 2019, 2016, 2013, 2010, and, to a lesser extent, 2007 and 2003 environment.

The report shows the following:

  •  As summary
    • Total number of servers per Exchange Server version
    • Total number of mailboxes per On-Premises Exchange Server version, Office 365, and Exchange Organisation
    • Total number of Exchange Server functional roles
  • Per Active Directory Site
    • Total number of mailboxes
    • Internal, External, and CAS Array names
    • Exchange Server computers
      • Product version
      • Service Pack, Update Rollup, and/or Cumulative Update
      • Number of preferred and maximum active databases
      • Functional Roles
      • Operating System with Service Pack
  • Per Database Availability Group
    • Total number of member servers
    • List of member servers
    • DAG databases
      • Number of mailboxes and average mailbox size
      • Number of archive mailboxes and average archive mailbox size
      • Database size
      • Database whitespace
      • Disk space available for database and log file volume
      • Last full backup timestamp
      • Circular logging enabled
      • Mailbox server hosting an active copy
      • List of mailbox servers hosting database copies
  • Per Database (Non-DAG, pre-DAG Exchange Server)
    • Storage group and database name
    • Server name hosting the database
    • Number of mailboxes and average mailbox size
    • Number of archive mailboxes and average archive mailbox size
    • Database size
    • Database whitespace
    • Disk space available for database and log file volume
    • Last full backup timestamp
    • Circular logging enabled

The script uses a separate CSS file for styling the HTML output.



# Example 1
# Generate an HTML report and send the result as HTML email with attachment 
# to the specified recipient using a dedicated smart host

.\Get-ExchangeEnvironmentReport.ps1 -HTMReport ExchangeEnvironment.html -SendMail `
-ViewEntireForet $true -MailFrom -MailTo -MailServer


Example Screenshot

Example report Exchange Environment Report


Version History

  • 2.0, Initial community release
  • 2.1, Table header label updated for a more consistent labeling




Additional Credits

Additional credits go to Steve Goodman for the original Exchange Environment Report V1.x scripts.




Read More »

Exchange Server 2016Exchange Server 2013Description

This script connects either to Exchange Online or to a dedicated on-premises Exchange Server to export configured mailbox delegates and SMTP forwarding configurations.

The SMTP forwarding configurations are gathered from inbox rules and from mailbox forwarding settings.



  • Exchange Server 2016 or newer
  • Cretenials to logon to Exchange Online and Office 365 when querying EXO mailboxes
  • Utilizes GlobalFunctions PowerShell Module -->



# Example 1
# Connect to the on-premises Exchange Server and export delegation and SMTP forwarding information
.\Get-DelegatesAndForwardingRules.ps1 -ExchangeHost

# Example 2
# Connect to the on-premises Exchange Server, export delegation and SMTP forwarding information and get verbose information on the objects worked on

 .\Get-DelegatesAndForwardingRules.ps1 -ExchangeHost -Verbose 

# Example 3
# Connect to Exchange Online and export delegation and SMTP forwarding information

 .\Get-DelegatesAndForwardingRules.ps1 -ExchangeOnline


Version History

  • 1.0, Initial community release



Use GitHub Issues to leave comments, requests, end even bugs or issues.


Additional Credits

The script is based on the O365-InvestigationTooling script DumpDelegatesandForwardingRules.ps1 by Brandon Koeller
Find more Office 365 investigation tooling scripts at




Read More »


You have an Exchange Server 2016 organization and plan to upgrade to Cumulative Update 10. You log on to an  Exchange Server, activate DAG maintenance and prepare the Server Component States for installing the new Cumulative Update. 

You open an elevated PowerShell Session and start the Setup using

./Setup.exe /Mode:Upgrade /IAcceptExchangeServerLicenseTerms

Out of a sudden the Exchange Server CU Setup fails while executing setup step Stopping Services with an error:

Microsoft Exchange Server 2016 Cumulative Update 10 Unattended Setup

Copying Files...
File copy complete. Setup will now collect additional information needed for installation.

Management tools
Mailbox role: Transport service
Mailbox role: Client Access service
Mailbox role: Unified Messaging service
Mailbox role: Mailbox service
Mailbox role: Front End Transport service
Mailbox role: Client Access Front End service

Performing Microsoft Exchange Server Prerequisite Check

    Configuring Prerequisites                                                                         COMPLETED
    Prerequisite Analysis                                                                             COMPLETED

Configuring Microsoft Exchange Server

    Preparing Setup                                                                                   COMPLETED
    Stopping Services                                                                                 FAILED

The following error was generated when "$error.Clear();
 & $RoleBinPath\ServiceControl.ps1 -Operation:DisableServices
-Roles:($RoleRoles.Replace('Role','').Split(',')) -SetupScriptsDirectory:$RoleBinPath; &
$RoleBinPath\ServiceControl.ps1 -Operation:Stop -Roles:($RoleRoles.Replace('Role','').Split(','))
 " was run: "Microsoft.PowerShell.Commands.ProcessCommandException: Cannot stop
process "fms (2496)" because of the following error: Access is denied ---> System.ComponentModel.Win32Exception: Access
is denied
 at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited)
 at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited)
 at System.Diagnostics.Process.get_HasExited()
 at Microsoft.PowerShell.Commands.StopProcessCommand.ProcessRecord()
End of inner exception stack trace ---".

The Exchange Server setup operation didn't complete. More details can be found in ExchangeSetup.log located in the
<SystemDrive>:\ExchangeSetupLogs folder.

Why would an error like Access Denied happen while executing the Setup.exe as a member of the local Administrators security group from within an elevated PowerShell session?



The PowerShell code executed as part of the CU Setup sets the startup type of Exchange and some Windows services to Disabled. This ensures that in the case of a server reboot an automatic start of the service will not interfere partially executed the setup. After setting the startup type to Disabled the services are stopped. 

The services are controlled by the ServiceControl.ps1 script which is located on the Exchange Server installation media in \Setup\ServerRoles\Common\.

The function StopServices stops services using the Stop-Service cmdlet. Due to some timing issues some services are stopped by killing the running processes using Stop-Process -Force.

The services stopped by stopping the running process are:

  • FMS
  • MSExchangeServiceHost
  • MSExchangeTransport
  • MSExchangeInferenceService
  • MSExchangeDagMgmt

Executing the Stop-Process cmdlet results in the Access Denied error.


The issue is related to fact that the user account logged on the server and executing the Exchange Server Cumulatice Update does not have the local User Rights Assignment to Debug Programs.

By default the right to debug programs is assigned to the local Adminstrators security group. In secured Active Directory infrastructures the user rights assignments and local security groups are often managed using Group Policy Objects (GPO). The GPOs manage the names of local security groups, group memberships and even user rights assignments.

  • To avoid the error described above you must ensure that the group of Exchange Administrators that install Exchange Server Cumulative Updates has the user rights assignment to debug programs.

The client encountering the issue described above hasn't had any issues installing Cumulative Updates for Exchange Server 2013 in the past. So this is solution is related to the setup of Exchange Server 2016 Cumulative Updates on Windows Server 2016 only. If you have any information regarding Exchange Server 2013, let me know using the comments section below.


Enjoy Exchange Server!


Read More »

The PowerShell script to Set mailbox quotas at database or mailbox level the simple way has been updated to Version 1.4.

The code has been refactored to functions and has received some PowerShell hygiene patters.

Please report any issues directly at Github.

If you like the script, please rate the script at TechNet Gallery.




Read More »