Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a dependency issue where the FreeBusyChecker script required the ExchangeOnlineManagement module even when checking only on-premises Exchange configurations. The fix allows the script to run on Exchange servers without the EXO module when using the -Org ExOnPremise parameter.
- Removed the static
#Requires -Module ExchangeOnlineManagementdirective - Added conditional checking and importing of the ExchangeOnlineManagement module only when needed
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
@MarcoLFrancisco to review |
MarcoLFrancisco
left a comment
There was a problem hiding this comment.
It is not allowed to import modules in script execution. Therefore "Import-Module ExchangeOnlineManagement -ErrorAction Stop" cant be used
In Exchange Online part we check if it is connected to Exchange online. A previous check can be done for Exchange Online Module and exit with write-host "Exchange Online Module not installed"
@MarcoLFrancisco You can actually use |
MarcoLFrancisco
left a comment
There was a problem hiding this comment.
Approved, thank you!
Understood. Thank you for the clarification. Approved. |
The script should still run if the -Org parameter is set to check ExOnPremise Only, e.g: Running on an exchange server with no direct outbound connection to Entra/EXO.. or modules cannot be installed.
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
@Ghost0s please address the code formatting for the pipeline to complete. |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
@Ghost0s please follow our contributing guides to get your PR to properly work and pass the build pipeline process: https://github.com/microsoft/CSS-Exchange/blob/main/CONTRIBUTING.md Then if you know how, please rebase your branch so there is only 1 commit on the branch you are trying to merge into ours. |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
@MedElhamm0uti as I provided before, you need to follow the contributing guide to get past the build pipeline. Otherwise, this PR will not merge. https://github.com/microsoft/CSS-Exchange/blob/main/CONTRIBUTING.md |
|
@MedElhamm0uti please address this soon or it will be closed out |

Issue:
The script cannot run on Exchange servers without the EXO module being installed even when checking only On-prem conf
Reason:
The script should still run if the -Org parameter is set to check ExOnPremise Only, e.g: Running on an exchange server with no direct outbound connection to Entra/EXO.. or where EXO module cannot be installed.
Fix:
Removed the static requirement for EXO module and replaced it with a conditional check.
Validation:
Provide if applicable