W pełni automatyzująca wymagania wstępne serwera Exchange za pomocą skryptu PowerShell
Jeśli planujesz zainstalować Microsoft Exchange Server 2019 i nowsze wersje, pomyśl o zautomatyzowaniu wymagań wstępnych Exchange Server w celu szybkiego wdrożenia. Zapewniamy Ci ochronę.
Ręczna instalacja programu Microsoft Exchange Server zajmuje dużo czasu, ponieważ trzeba pobierać różne pakiety oprogramowania z różnych źródeł.
Po ich pobraniu i zainstalowaniu należy zainstalować wymagane funkcje systemu Windows, a następnie rozszerzyć schemat, przygotować AD i wszystkie domeny.
Ręczne wykonanie tej czynności zajmuje trochę czasu, a jeśli coś pominiesz, instalacja programu Exchange nie będzie kontynuowana i wyświetli monit o zainstalowanie brakującej funkcji.
W tym przewodniku przeprowadzę Cię przez w pełni zautomatyzowany skrypt PowerShell, który konfigurujewszystkie niezbędne komponentydla serwera Exchange 2019.
Takie jak funkcje systemu Windows, .NET Framework, produkty redystrybucyjne C++, UCMA i przepisywanie adresów URL.
Zostanie to zrobione za pomocą skryptu wymagań wstępnych Exchange Server 2019, który jest w pełni zautomatyzowaną kompilacją w PowerShell.
Ten skrypt programu Exchange PowerShell jest szybki, łatwy i bezpieczny, a zatem wolny od błędów, umożliwiający automatyzację wymagań wstępnych programu Exchange Server w celu szybkiego wdrożenia serwera Exchange.
Co skrypt robi automatycznie
Zwykle wiesz, że przed instalacją serwera Exchange należy zainstalować wiele oprogramowania i funkcji.
Ten skrypt automatycznie zajmie się instalacją następującego oprogramowania i funkcji.
- Instaluje .NET Framework 4.8
- Instaluje pakiety redystrybucyjne Visual C++ (2012 i 2013)
- Instaluje wymagane role i funkcje systemu Windows Server
- Instaluje moduł przepisywania adresu URL
- Instaluje UCMA 4.0
- Zapewnia, że jesteś gotowy na przygotowanie schematu/domeny Exchange
Dlatego sprawdza również, czy jakaś funkcja lub oprogramowanie jest już zainstalowana.
Jeśli jednak znajdzie już zainstalowane oprogramowanie i funkcję, pominie ten krok i przejdzie dalej.
Automatycznie przygotuj także kontroler domeny
Jak wiadomo, musimy zainstalować .NET Framework, pakiety redystrybucyjne C++ na kontrolerze domeny, a także kilka innych funkcji systemu Windows.

Aby to zautomatyzować, możesz uruchomić następujący skrypt przed uruchomieniem skryptu wymagań wstępnych automatyzacji serwera Exchange.
# Active Directory Prerequisites Full Installer
# By Techi Jack
Write-Host "Starting Microsoft Exchange AD Prerequisite Installer..." -ForegroundColor Cyan
# Function to check if a redistributable is installed
function Is-VCRedistInstalled {
param ([string]$DisplayName)
$keys = @(
"HKLM:SOFTWAREMicrosoftWindowsCurrentVersionUninstall*",
"HKLM:SOFTWAREWOW6432NodeMicrosoftWindowsCurrentVersionUninstall*"
)
foreach ($key in $keys) {
if (Get-ItemProperty $key -ErrorAction SilentlyContinue | Where-Object { $_.DisplayName -like "*$DisplayName*" }) {
return $true
}
}
return $false
}
# Function to check .NET Framework 4.8 or later
function Is-DotNetFramework48Installed {
$releaseKey = Get-ItemProperty -Path "HKLM:SOFTWAREMicrosoftNET Framework SetupNDPv4Full" -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Release
return ($releaseKey -ge 528040)
}
# Install .NET Framework 4.8 if not installed
if (-not (Is-DotNetFramework48Installed)) {
Write-Host "Installing .NET Framework 4.8..." -ForegroundColor Cyan
$dotNetUrl = "https://download.microsoft.com/download/2/4/8/24892799-1635-47E3-AAD7-9842E59990C3/ndp48-web.exe"
$dotNetPath = "$env:TEMPndp48-web.exe"
Invoke-WebRequest -Uri $dotNetUrl -OutFile $dotNetPath
Start-Process -FilePath $dotNetPath -ArgumentList "/quiet /norestart" -Wait
} else {
Write-Host ".NET Framework 4.8 or newer already installed, skipping..." -ForegroundColor Green
}
# C++ 2012 (x64)
if (-not (Is-VCRedistInstalled -DisplayName "Visual C++ 2012 x64")) {
Write-Host "Installing Visual C++ 2012 x64..." -ForegroundColor Cyan
$vc2012Url = "https://download.microsoft.com/download/1/6/b/16b06f60-3b20-4ff2-b699-5e9b7962f9ae/VSU_4/vcredist_x64.exe"
$vc2012Path = "$env:TEMPvcredist2012_x64.exe"
Invoke-WebRequest -Uri $vc2012Url -OutFile $vc2012Path
Start-Process -FilePath $vc2012Path -ArgumentList "/install /quiet /norestart" -Wait
} else {
Write-Host "Visual C++ 2012 x64 already installed, skipping..." -ForegroundColor Green
}
# C++ 2013 (x64)
if (-not (Is-VCRedistInstalled -DisplayName "Visual C++ 2013 x64")) {
Write-Host "Installing Visual C++ 2013 x64..." -ForegroundColor Cyan
$vc2013Url = "https://download.visualstudio.microsoft.com/download/pr/10912041/cee5d6bca2ddbcd039da727bf4acb48a/vcredist_x64.exe"
$vc2013Path = "$env:TEMPvcredist2013x64.exe"
Invoke-WebRequest -Uri $vc2013Url -OutFile $vc2013Path
Start-Process -FilePath $vc2013Path -ArgumentList "/install /quiet /norestart" -Wait
} else {
Write-Host "Visual C++ 2013 x64 already installed, skipping..." -ForegroundColor Green
}
# Define required features
$features = @(
"RSAT-ADDS"
)
Write-Host "Checking and installing Windows prerequisites..." -ForegroundColor Cyan
foreach ($feature in $features) {
$status = Get-WindowsFeature -Name $feature
if ($status.Installed) {
Write-Host "$feature is already installed. Skipping..." -ForegroundColor Yellow
} else {
Write-Host "Installing $feature..." -ForegroundColor Green
Install-WindowsFeature -Name $feature -IncludeAllSubFeature -Verbose
}
}
Write-Host "All AD prerequisites handled successfully." -ForegroundColor Magenta
Jak korzystać ze skryptu automatyzującego wymagania wstępne programu Exchange
Możesz skopiować skrypt z poniższego fragmentu i zapisać go pod dowolną nazwą z rozszerzeniem .ps1.
W naszym przypadku zapisaliśmy go w folderze skryptów na dysku C.
# Exchange Server 2019 Prerequisites Full Installer
# By Techi Jack
Write-Host "Starting Microsoft Exchange Prerequisite Installer..." -ForegroundColor Cyan
# Function to check if a redistributable is installed
function Is-VCRedistInstalled {
param ([string]$DisplayName)
$keys = @(
"HKLM:SOFTWAREMicrosoftWindowsCurrentVersionUninstall*",
"HKLM:SOFTWAREWOW6432NodeMicrosoftWindowsCurrentVersionUninstall*"
)
foreach ($key in $keys) {
if (Get-ItemProperty $key -ErrorAction SilentlyContinue | Where-Object { $_.DisplayName -like "*$DisplayName*" }) {
return $true
}
}
return $false
}
# Function to check .NET Framework 4.8 or later
function Is-DotNetFramework48Installed {
$releaseKey = Get-ItemProperty -Path "HKLM:SOFTWAREMicrosoftNET Framework SetupNDPv4Full" -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Release
return ($releaseKey -ge 528040)
}
# Install .NET Framework 4.8 if not installed
if (-not (Is-DotNetFramework48Installed)) {
Write-Host "Installing .NET Framework 4.8..." -ForegroundColor Cyan
$dotNetUrl = "https://download.microsoft.com/download/2/4/8/24892799-1635-47E3-AAD7-9842E59990C3/ndp48-web.exe"
$dotNetPath = "$env:TEMPndp48-web.exe"
Invoke-WebRequest -Uri $dotNetUrl -OutFile $dotNetPath
Start-Process -FilePath $dotNetPath -ArgumentList "/quiet /norestart" -Wait
} else {
Write-Host ".NET Framework 4.8 or newer already installed, skipping..." -ForegroundColor Green
}
# C++ 2012 (x64)
if (-not (Is-VCRedistInstalled -DisplayName "Visual C++ 2012 x64")) {
Write-Host "Installing Visual C++ 2012 x64..." -ForegroundColor Cyan
$vc2012Url = "https://download.microsoft.com/download/1/6/b/16b06f60-3b20-4ff2-b699-5e9b7962f9ae/VSU_4/vcredist_x64.exe"
$vc2012Path = "$env:TEMPvcredist2012_x64.exe"
Invoke-WebRequest -Uri $vc2012Url -OutFile $vc2012Path
Start-Process -FilePath $vc2012Path -ArgumentList "/install /quiet /norestart" -Wait
} else {
Write-Host "Visual C++ 2012 x64 already installed, skipping..." -ForegroundColor Green
}
# C++ 2013 (x64)
if (-not (Is-VCRedistInstalled -DisplayName "Visual C++ 2013 x64")) {
Write-Host "Installing Visual C++ 2013 x64..." -ForegroundColor Cyan
$vc2013Url = "https://download.visualstudio.microsoft.com/download/pr/10912041/cee5d6bca2ddbcd039da727bf4acb48a/vcredist_x64.exe"
$vc2013Path = "$env:TEMPvcredist2013x64.exe"
Invoke-WebRequest -Uri $vc2013Url -OutFile $vc2013Path
Start-Process -FilePath $vc2013Path -ArgumentList "/install /quiet /norestart" -Wait
} else {
Write-Host "Visual C++ 2013 x64 already installed, skipping..." -ForegroundColor Green
}
# Define required features
$features = @(
"Server-Media-Foundation", "NET-Framework-45-Features", "RPC-over-HTTP-proxy", "RSAT-Clustering",
"RSAT-Clustering-CmdInterface", "RSAT-Clustering-Mgmt", "RSAT-Clustering-PowerShell", "WAS-Process-Model",
"Web-Asp-Net45", "Web-Basic-Auth", "Web-Client-Auth", "Web-Digest-Auth", "Web-Dir-Browsing", "Web-Dyn-Compression",
"Web-Http-Errors", "Web-Http-Logging", "Web-Http-Redirect", "Web-Http-Tracing", "Web-ISAPI-Ext", "Web-ISAPI-Filter",
"Web-Lgcy-Mgmt-Console", "Web-Metabase", "Web-Mgmt-Console", "Web-Mgmt-Service", "Web-Net-Ext45", "Web-Request-Monitor",
"Web-Server", "Web-Stat-Compression", "Web-Static-Content", "Web-Windows-Auth", "Web-WMI", "Windows-Identity-Foundation",
"RSAT-ADDS", "NET-WCF-HTTP-Activation45", "NET-WCF-Pipe-Activation45"
)
Write-Host "Checking and installing Windows prerequisites..." -ForegroundColor Cyan
foreach ($feature in $features) {
$status = Get-WindowsFeature -Name $feature
if ($status.Installed) {
Write-Host "$feature is already installed. Skipping..." -ForegroundColor Yellow
} else {
Write-Host "Installing $feature..." -ForegroundColor Green
Install-WindowsFeature -Name $feature -IncludeAllSubFeature -Verbose
}
}
# URL Rewrite
$rewriteDll = "$env:SystemRootSystem32inetsrvrewrite.dll"
if (-not (Test-Path $rewriteDll)) {
Write-Host "Installing IIS URL Rewrite Module 2.1..." -ForegroundColor Yellow
$urlRewriteUrl = "https://download.microsoft.com/download/1/2/8/128E2E22-C1B9-44A4-BE2A-5859ED1D4592/rewrite_amd64_en-US.msi"
$urlRewritePath = "$env:TEMPrewrite_2.1_x64.msi"
Invoke-WebRequest -Uri $urlRewriteUrl -OutFile $urlRewritePath
Start-Process -FilePath "msiexec.exe" -ArgumentList "/i `"$urlRewritePath`" /quiet /norestart" -Wait
Write-Host "URL Rewrite Module installed." -ForegroundColor Cyan
} else {
Write-Host "URL Rewrite already installed, skipping..." -ForegroundColor Green
}
function Is-UCMAInstalled {
$ucmaPath = "C:Program FilesMicrosoft UCMA 4.0"
return (Test-Path $ucmaPath)
}
$UcmaDownloadUrl = "https://download.microsoft.com/download/2/c/4/2c47a5c1-a1f3-4843-b9fe-84c0032c61ec/UcmaRuntimeSetup.exe"
$UcmaInstaller = "$env:TEMPUcmaRuntimeSetup.exe"
if (-not (Is-UCMAInstalled)) {
Write-Host "UCMA 4.0 not detected." -ForegroundColor Cyan
if (-not (Test-Path $UcmaInstaller)) {
Write-Host "Downloading UCMA installer..." -ForegroundColor Cyan
Invoke-WebRequest -Uri $UcmaDownloadUrl -OutFile $UcmaInstaller -UseBasicParsing
} else {
Write-Host "UCMA installer already exists. Skipping download." -ForegroundColor Yellow
}
Write-Host "Installing UCMA 4.0..." -ForegroundColor Cyan
Start-Process -FilePath $UcmaInstaller -ArgumentList "/quiet" -Wait
Write-Host "UCMA 4.0 installation completed." -ForegroundColor Green
} else {
Write-Host "UCMA 4.0 is already installed. Skipping installation and download." -ForegroundColor Green
}
Write-Host "All prerequisites handled successfully." -ForegroundColor Magenta
- Upewnij się, że Windows Server 2019 lub 2022 (najnowsza łatka)
- Prawa administratora (Uruchom jako administrator)
- Dostęp do Internetu (w celu pobrania zależności
Otwórz PowerShell jako administrator
Przejdź do folderu skryptów i uruchom skrypt
Jeśli zapisałeś skrypt pod nazwą ExchangePrequirements.ps1, uruchom następujące polecenie
Przykład:
c:scripts> .ExchangePrerequisites.ps1Po uruchomieniu skryptu możesz postępować zgodnie z instrukcjami wyświetlanymi na ekranie, aby sprawdzić proces.
Automatycznie pobierze i zainstaluje oprogramowanie oraz funkcje systemu Windows.


- Oszczędza to godziny ręcznej konfiguracji
- Pozwala uniknąć pominięcia wymagań wstępnych lub błędów konfiguracji programu Exchange
- Idealny do wdrożeń laboratoryjnych, produkcyjnych lub doradczych
- Całkiem bezpieczne, ponieważ jest to świeży serwer, więc nic nie tracisz
Wskazówki dotyczące szybkiego rozwiązywania problemów
Jeśli skrypt nie jest uruchomiony, toustaw politykę wykonanianajpierw uruchamiając następujące polecenie cmdlet
Set-ExecutionPolicy RemoteSigned -Scope ProcessJeśli ponowne zapisanie adresu URL nie powiedzie się, upewnij się, że najpierw zainstalowano usługi IIS
Dlatego jeśliUCMAnie instaluje się, sprawdź połączenie internetowe lub, jeśli adres URL oprogramowania ulegnie zmianie, zainstaluj je ręcznie.
Uwaga: jednak ten skrypt najpierw zainstaluje funkcję IIS, dzięki czemu polecenie URL Rewrite nie wyświetli monitu o żaden błąd
Ostatnie przemyślenia
Jeśli konfigurujesz Exchange Server 2019 i chcesz miećszybka i bezbłędna konfiguracja, ten skrypt znacznie ułatwi Ci pracę. Dodaj tę stronę do zakładek lub zasubskrybuj mój kanał, aby uzyskać więcej treści Exchange, Proxmox i Mailcow.
Mam nadzieję, że przypadną Ci do gustu niektóre tutoriale dotyczące Microsoft Exchange
Dowiedz się więcej:Aktualizacje poprawek serwera Exchange z kwietnia 2025 r
Jak odnowić certyfikat federacji Exchange
Skrypt programu PowerShell sprawdzający kondycję serwera Exchange
Dlatego jeśli napotkasz jakikolwiek problem z serwerem Exchange, lokalnym lub hybrydowym Exchange
Zapraszamy do kontaktu pod adresem[e-mail chroniony]
Co więcej, możesz zobaczyć każdy etap działania, w tym instalację w czasie rzeczywistym i działanie każdego komponentu.




![Jak cofnąć kopię zapasową urządzeń na zdjęciach Google [Przewodnik]](https://elsefix.com/tech/afton/wp-content/uploads/cache/2025/04/1746012918_Google-Photos-Undo-Device-Backup.jpg)








