Skip to content

Commit 1787869

Browse files
committed
Script updated checking is gateway is already installed and other checks
1 parent 931ec7a commit 1787869

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

Blog/PowerShell/Install-WAC.ps1

+23-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,27 @@
88

99
$WAC_Online = "http://aka.ms/WACDownload"
1010
$WAC_Installer = "C:\windows\Temp\wac.msi"
11+
$Port = 443
12+
13+
$IsAdminCenterInstalled = [bool] (Get-WmiObject -class win32_product | Where-Object {$_.Name -eq "Windows Admin Center"})
14+
15+
If ($IsAdminCenterInstalled){
16+
$ReInstall = Read-Host "Admin Center is already installed do you want to re-install or upgrade it? [Y/N]"
17+
If ( ("N","n") -contains $ReInstall){
18+
Write-Warning "Windows Admin Center is already installed and no further action is required."
19+
Exit 0
20+
}
21+
}
22+
1123
Invoke-WebRequest -Uri $WAC_Online -OutFile $WAC_Installer
12-
msiexec /i $WAC_Installer /qn SME_PORT=443 SSL_CERTIFICATE_OPTION=generate
24+
msiexec /i $WAC_Installer /qn SME_PORT=$Port SSL_CERTIFICATE_OPTION=generate
25+
26+
#Post Installation Checks
27+
do {
28+
if ((Get-Service ServerManagementGateway).status -ne "Running"){
29+
Write-Output "Starting for Windows Admin Center"
30+
Start-Service ServerManagementGateway
31+
}
32+
Start-sleep -Seconds 5
33+
} until ((Test-NetConnection -ComputerName "localhost" -port $Port).TcpTestSucceeded)
34+
Write-Output "Installation completed and Windows Admin Center is running as expected."

0 commit comments

Comments
 (0)