9
9
$WAC_Online = " http://aka.ms/WACDownload"
10
10
$WAC_Installer = " C:\windows\Temp\wac.msi"
11
11
$Port = 443
12
-
12
+
13
+ # Leave it blank if you want to generate a Self-Signed Certificate.
14
+ $CertificateThumbprint = " "
13
15
$IsAdminCenterInstalled = [bool ] (Get-WmiObject - class win32_product | Where-Object {$_.Name -eq " Windows Admin Center" })
14
16
15
17
If ($IsAdminCenterInstalled ){
16
- $ReInstall = Read-Host " Admin Center is already installed do you want to re-install or upgrade it? [Y/N]"
18
+ $ReInstall = Read-Host " Admin Center is already installed. Do you want to re-install/ upgrade it? [Y/N]"
17
19
If ( (" N" , " n" ) -contains $ReInstall ){
18
- Write-Warning " Windows Admin Center is already installed and no further action is required."
20
+ Write-Warning " Ok, No further action is required."
19
21
Exit 0
20
22
}
21
23
}
22
-
23
24
Invoke-WebRequest - Uri $WAC_Online - OutFile $WAC_Installer
24
- msiexec / i $WAC_Installer / qn SME_PORT= $Port SSL_CERTIFICATE_OPTION= generate
25
+ # if CertificateThumbprint is defined and installed on the system will be used during the installation
26
+ if ([bool ](get-childitem cert: - recurse | where-object {$_.thumbprint -eq $CertificateThumbprint })){
27
+ msiexec / i $WAC_Installer / qn SME_PORT= $Port SME_THUMBPRINT= $CertificateThumbprint SSL_CERTIFICATE_OPTION= installed
28
+ }
29
+ else {
30
+ msiexec / i $WAC_Installer / qn SME_PORT= $Port SSL_CERTIFICATE_OPTION= generate
31
+ }
25
32
26
33
# Post Installation Checks
27
34
do {
28
35
if ((Get-Service ServerManagementGateway).status -ne " Running" ){
29
- Write-Output " Starting Windows Admin Center Service"
36
+ Write-Output " Starting Windows Admin Center (ServerManagementGateway) Service"
30
37
Start-Service ServerManagementGateway
31
38
}
32
39
Start-sleep - Seconds 5
33
40
} until ((Test-NetConnection - ComputerName " localhost" - port $Port ).TcpTestSucceeded)
41
+
34
42
Write-Output " Installation completed and Windows Admin Center is running as expected."
0 commit comments