Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FreeBusyChecker Final Version #2264

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 12 additions & 13 deletions Diagnostics/FreeBusyChecker/FreeBusyChecker.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@ param(
[Parameter(Mandatory = $false, ParameterSetName = "Test")]
[string]$OnPremEWSUrl,
[Parameter(Mandatory = $false, ParameterSetName = "Test")]
[string]$OnPremLocalDomain
[string]$OnPremLocalDomain,
[Parameter(Mandatory = $true, ParameterSetName = "ScriptUpdateOnly", HelpMessage = "Update only script.")]
[switch]$ScriptUpdateOnly,
[Parameter(Mandatory = $false, ParameterSetName = "SkipVersionCheck", HelpMessage = "Skip version check.")]
[switch]$SkipVersionCheck
)
begin {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add GenericScriptUpdate.ps1 here? This adds update capabilities to the script and allows the script to perform an auto-update whenever a new version is released.

Copy link
Contributor Author

@MarcoLFrancisco MarcoLFrancisco Jan 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added this:

image

The version CSV does not hold information about this script. I suppose this message will display Script Name and version when the csv holds this information:

image

I see implementations with aka url poiting to csv update file. Should I create one?

image

Can't test this., so not sure if I understood correctly.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It isn't required, but you can put one there.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, i will commit this evening

. $PSScriptRoot\Functions\OnPremDAuthFunctions.ps1
Expand All @@ -107,14 +111,15 @@ begin {
. $PSScriptRoot\Functions\htmlContent.ps1
. $PSScriptRoot\Functions\hostOutput.ps1
. $PSScriptRoot\Functions\CommonFunctions.ps1
. $PSScriptRoot\..\..\Shared\Confirm-ExchangeShell.ps1
. $PSScriptRoot\..\..\Shared\ScriptUpdateFunctions\GenericScriptUpdate.ps1
} end {
$Script:countOrgRelIssues = (0)
$Script:WebServicesVirtualDirectory = $null
$Script:Server = hostname
$Script:startingDate = (Get-Date -Format yyyyMMdd_HHmmss)
$Script:htmlFile = "$PSScriptRoot\FBCheckerOutput_$($Script:startingDate).html"

CheckIfExchangeServer($Script:Server)
loadingParameters
#Parameter input

Expand Down Expand Up @@ -147,14 +152,9 @@ begin {
$Script:ExchangeOnPremDomain = ($Script:UserOnPrem -split "@")[1]

if (-not $OnPremEWSUrl) {

$EWSVirtualDirectory = Get-WebServicesVirtualDirectory -server $Script:Server -ErrorAction SilentlyContinue
if ($EWSVirtualDirectory.externalURL.AbsoluteUri.Count -gt 1) {
$Script:ExchangeOnPremEWS = ($EWSVirtualDirectory.externalURL.AbsoluteUri)[0]
} else {
$Script:ExchangeOnPremEWS = ($EWSVirtualDirectory.externalURL.AbsoluteUri)
}
FetchEWSInformation
} else {
FetchEWSInformation
$Script:ExchangeOnPremEWS = ($OnPremEWSUrl)
}

Expand Down Expand Up @@ -182,13 +182,13 @@ begin {
exit
}
#region Show Parameters
$Script:IntraOrgCon = Get-IntraOrganizationConnector -WarningAction SilentlyContinue -ErrorAction SilentlyContinue | Select-Object Name, TarGetAddressDomains, DiscoveryEndpoint, Enabled
$Script:IntraOrgCon = Get-IntraOrganizationConnector -WarningAction SilentlyContinue -ErrorAction SilentlyContinue | Where-Object { $_.TargetAddressDomains -contains $Script:ExchangeOnlineDomain } | Select-Object Name, TarGetAddressDomains, DiscoveryEndpoint, Enabled
ShowParameters
CheckParameters
if ($Script:IntraOrgCon.enabled -like "True") {
if ($Script:IntraOrgCon.enabled -eq $true) {
$Auth = hostOutputIntraOrgConEnabled($Auth)
}
if ($Script:IntraOrgCon.enabled -like "False") {
if ($Script:IntraOrgCon.enabled -eq $false) {
hostOutputIntraOrgConNotEnabled
}
# Free busy Lookup methods
Expand Down Expand Up @@ -249,7 +249,6 @@ begin {
if (-not ($Exo)) {
Write-Host -ForegroundColor Red "`n Please connect to Exchange Online Using the EXO V3 module using EO as connection Prefix to collect Exchange OnLine Free Busy configuration Information."
Write-Host -ForegroundColor Cyan "`n`n Example: PS C:\Connect-ExchangeOnline -Prefix EO"
Write-Host -ForegroundColor Cyan "`n Example: PS C:\Connect-ExchangeOnline -Prefix EO -Org ExchangeOnline"
Write-Host -ForegroundColor Yellow "`n More Info at:https://learn.microsoft.com/en-us/powershell/exchange/exchange-online-powershell-v2?view=exchange-ps"
exit
}
Expand Down
10 changes: 4 additions & 6 deletions Diagnostics/FreeBusyChecker/Functions/CommonFunctions.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ function Test-ExchangeOnlineConnection {
Write-Host -ForegroundColor Green " Checking Exchange Online Configuration"
Write-Host " Testing Connection to Exchange Online with EO Prefix."
try {
$CheckExoMailbox = get-EOMailbox $Script:UserOnline -ErrorAction Stop
$CheckExoMailbox = Get-EOMailbox $Script:UserOnline -ErrorAction Stop
if ($null -ne $CheckExoMailbox) {
return $true
} else {
Expand All @@ -24,14 +24,12 @@ function FetchEWSInformation {
if (-not $Script:WebServicesVirtualDirectory -or -not $Script:WebServicesVirtualDirectoryOAuth) {
$Script:WebServicesVirtualDirectory = Get-WebServicesVirtualDirectory -Server $Script:Server | Select-Object Identity, Name, ExchangeVersion, *Authentication*, *url -ErrorAction SilentlyContinue
Copy link
Contributor

@lusassl-msft lusassl-msft Jan 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These Get- calls to query the virtual directory information are very time consuming as we query IIS metabase. Can we check if the required information are available in AD tool (by using -ADPropertiesOnly switch parameter). This would improve the execution time of the script. Not all information are stored in AD but we should at least confirm for the use-case of the script.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, great point! Will do.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added:

image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

However, if you NEED to have the correct authentication values, then you can't include -ADPropertiesOnly as that doesn't have the information that you need.

image

Copy link
Contributor Author

@MarcoLFrancisco MarcoLFrancisco Jan 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-ADPropertiesOnly indeed can't be used

Get-WebServicesVirtualDirectory was called multiple times.

It is called initially as it is a required Initial Parameter. It was also called on DAuth and Oauth Checks. It was executed 3 times if user inputs -Auth All when calling script:

image

image

Now it is called only once initially:

image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, run the cmdlet once and then store it in a script variable or get it with a cmdlet that has it stored within a script variable.

$Script:WebServicesVirtualDirectoryOAuth = $Script:WebServicesVirtualDirectory
$Script:ExchangeOnPremEWS = ($Script:WebServicesVirtualDirectory.externalURL.AbsoluteUri)
}
}
function CheckIfExchangeServer {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd recommend using Confirm-ExchangeShell here (shared function).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added:

image

image

param (
[string]$Server
)
$exchangeServer = Get-ExchangeServer $Server -ErrorAction SilentlyContinue
if (!$exchangeServer) {
$exchangeShell = Confirm-ExchangeShell
if (-not($exchangeShell.ShellLoaded)) {
Write-Host "$Server is not an Exchange Server. This script should be run in Exchange Server Management Shell"
exit
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,6 @@ function AutoDVirtualDCheck {
function EWSVirtualDirectoryCheck {
Write-Host -ForegroundColor Green " Get-WebServicesVirtualDirectory -Server $($server)| Select Identity,Name,ExchangeVersion,*Authentication*,*url"
PrintDynamicWidthLine
FetchEWSInformation
$Script:WebServicesVirtualDirectory
PrintDynamicWidthLine
Write-Host -ForegroundColor Green " Summary - Get-WebServicesVirtualDirectory"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,6 @@ function AutoDVirtualDCheckOauth {
function EWSVirtualDirectoryCheckOAuth {
Write-Host -ForegroundColor Green " Get-WebServicesVirtualDirectory -Server $($server)| Select Identity,Name,ExchangeVersion,*Authentication*,*url"
PrintDynamicWidthLine
FetchEWSInformation
$W = $WebServicesVirtualDirectoryOAuth | Format-List
$W
EWSVirtualDirectoryCheckOAuthHtmlHead
Expand Down Expand Up @@ -624,7 +623,6 @@ function EWSVirtualDirectoryCheckOAuth {
}
Write-Host -ForegroundColor White " Should be True"
}
#PrintDynamicWidthLine
Write-Host -ForegroundColor White "`n WindowsAuthentication:"
if ($WebServicesVirtualDirectoryOauth.WindowsAuthentication -eq "True") {
foreach ( $ser in $WebServicesVirtualDirectoryOauth) {
Expand Down
16 changes: 5 additions & 11 deletions docs/Diagnostics/FreeBusyChecker/FreeBusyChecker.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ To Provide Feedback about this tool: [Feedback Form](https://forms.office.com/pa

Use: Collects OAuth and DAuth Hybrid Availability Configuration Settings Both for Exchange On Premises and Exchange Online if connected to Exchange Online using -Prefix EO before executing this script (see Usage bellow).

How To Run:

This script must be run as Administrator in Exchange Management Shell on an Exchange Server. You can provide no parameters, and the script will just run against Exchange On-Premises and Exchange Online to query for OAuth and DAuth configuration settings. It will compare existing values with standard values and provide details of what may not be correct.
Please take note that though this script may output that a specific setting is not a standard setting, it does not mean that your configurations are incorrect. For example, DNS may be configured with specific mappings that this script cannot evaluate.

Example Screen Output:

![image](./image1.png)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure to redact the valid tenant information (e.g., DomainNames). We are not allowed to use non-CELA approved domains in our documentations.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, this needs to be done and squashed to avoid a commit history showing the incorrect names.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Domains redacted

Expand Down Expand Up @@ -40,17 +45,6 @@ Please make sure that the account used is a member of the Local Administrator gr

Other Pre Requisites:

AD management Tools:

If not available, they can be installed with the following command:

```powershell
Install-WindowsFeature -name AD-Domain-Services -IncludeManagementTools
```
Imports and Installs the following Modules (if not available):

PSSnapin: microsoft.exchange.management.powershell.snapin

Module : ActiveDirectory Module
Module : ExchangeOnlineManagement Module

Expand Down
Binary file modified docs/Diagnostics/FreeBusyChecker/image1.png
dpaulson45 marked this conversation as resolved.
Show resolved Hide resolved
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/Diagnostics/FreeBusyChecker/image2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/Diagnostics/FreeBusyChecker/image3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.