Setting up Get-ExchangeEnvironmentReport.ps1 PowerShell script in Task Scheduler to automatically run daily

One of the scripts I’ve often used when trying gather information about a current Exchange environment prior to performing a migration is the Get-ExchangeEnvironmentReport.ps1 PowerShell script written by Steve Goodman.  The information provided by the report provides great information that would allow me to get a good understanding of the current Exchange topology as well as the mailbox databases.  If you are unfamiliar with this script, further details about the script can be found in the following links:

Generate Exchange Environment Reports using Powershell
https://gallery.technet.microsoft.com/office/Generate-Exchange-2388e7c9

Generate Exchange Environment Reports using Powershell
http://www.stevieg.org/2011/06/exchange-environment-report/

This script could be scheduled to automatically run via the Task Scheduler and this post serves to provide the configuration for the action which sometimes can be difficult to find.  Note that I won’t go into the details of creating the scheduled task as that could be found in one of my previous posts here:

Setting up vCheck PowerShell health check script in Task Scheduler to automatically run daily
https://blog.terenceluk.com/2017/03/setting-up-vcheck-powershell-health.html

The following is the syntax required to configure the action:

Program/script: powershell.exe

Add arguments (option): -command “. ‘E:Program FilesMicrosoftExchange ServerV15binRemoteExchange.ps1’; Connect-ExchangeServer -auto; . ‘C:PS-ScriptsGet-ExchangeEnvironmentReportModified.ps1’

clip_image002