Patch
CVE-2024-21410
with vRx
Introduction:
In today's threat landscape, securing Exchange Server against vulnerabilities is paramount. PowerShell scripts offer a powerful solution to automate security measures, such as enabling Extended Protection. This article provides a comprehensive explanation and usage guide for a PowerShell script designed to automate Exchange Server Extended Protection.
Understanding the Script:
The PowerShell script is built with modular functions to perform tasks like checking TLS configurations, enabling or disabling Extended Protection, and validating IP restrictions. It utilizes parameters to customize actions based on specific Exchange Server names or skip certain servers.
Script:
[CmdletBinding(SupportsShouldProcess=$true)]
param(
[Parameter(Mandatory=$false)]
[string[]]$ExchangeServerNames,
[Parameter(Mandatory=$false)]
[string[]]$SkipExchangeServerNames,
[Parameter(Mandatory=$false)]
[string]$FindExchangeServerIPAddresses,
[Parameter(Mandatory=$false)]
[string]$RestrictType,
[Parameter(Mandatory=$false)]
[string]$IPRangeFilePath,
[Parameter(Mandatory=$false)]
[string]$ValidateType,
[Parameter(Mandatory=$false)]
[string]$RollbackType,
[Parameter(Mandatory=$false)]
[string]$OutputFilePath
)
# Retrieve list of Exchange Servers
$ExchangeServerList = Get-ExchangeServer
# Filter Exchange Servers based on provided names
if ($ExchangeServerNames) {
$ExchangeServerList = $ExchangeServerList | Where-Object {$ExchangeServerNames -contains $_.Name}
}
# Exclude Exchange Servers based on provided names
if ($SkipExchangeServerNames) {
$ExchangeServerList = $ExchangeServerList | Where-Object {$SkipExchangeServerNames -notcontains $_.Name}
}
# Function to check TLS configuration
function Check-TLSConfiguration([string]$ServerName) {
# Code removed for brevity
}
# Function to enable Extended Protection
function Enable-ExtendedProtection([string]$ServerName) {
# Code removed for brevity
}
# Function to disable Extended Protection
function Disable-ExtendedProtection([string]$ServerName) {
# Code removed for brevity
}
# Function to rollback Extended Protection changes
function Rollback-ExtendedProtection([string]$ServerName, [string]$RollbackType) {
# Code removed for brevity
}
# Function to validate IP restrictions
function Validate-IPRestrictions([string]$ServerName, [string]$RestrictType, [string]$IPRangeFilePath) {
# Code removed for brevity
}
# Function to get Exchange Server IP addresses
function Get-ExchangeServerIPAddresses([string]$ServerName, [string]$OutputFilePath) {
# Code removed for brevity
}
# Iterate through Exchange Servers
foreach ($Server in $ExchangeServerList) {
# Check if Exchange Server version is 15
if ($Server.AdminDisplayVersion -match "^Version 15") {
# Check TLS configuration
Check-TLSConfiguration $Server.Name
# Enable Extended Protection
Enable-ExtendedProtection $Server.Name
}
}
Usage Guide:
Customize Parameters: Define Exchange Server names or skip certain servers as needed.
Run the Script: Execute the PowerShell script to automate Extended Protection tasks.
Review Output: Check script output for any errors or successful execution.
Validate Changes: Ensure TLS configurations and IP restrictions are validated and updated accordingly.
automate the execution of the PowerShell script in a batch file (.bat):
Open Notepad or any text editor.
Paste the following lines into the text editor:
@echo off REM Change the path to the PowerShell script file accordingly powershell.exe -ExecutionPolicy Bypass -File "C:\Path\To\Your\Script.ps1"
Replace "C:\Path\To\Your\Script.ps1" with the actual path to your PowerShell script file.
Save the file with a .bat extension, for example, RunScript.bat.
Double-click the .bat file to execute the PowerShell script.
Conclusion:
Automating Exchange Server security with PowerShell provides a proactive approach to safeguarding critical systems against evolving threats. By leveraging the provided script and understanding its functionalities, organizations can enhance their security posture, mitigate vulnerabilities, and protect sensitive data effectively.
Read more
Read less
Patch faster and smarter
with vRx
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
More than 600 customers trust vRx:




Solution
Remediate faster with vRx
Patch Management
vRx automatically deploys patches across all systems, cutting patching time by 80%.
Scripting Engine
vRx’s scripting engine solves complex vulnerabilities, like log4j, with built-in or custom scripts.
Patchless Protection
vRx’s Patchless Protection secures vulnerable apps and reduces risk while maintaining functionality.

Automated Patching, Scripting, and more
Talk with our team to get a personal walkthrough
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.