mirror of
https://github.com/actions/runner-images.git
synced 2026-01-09 03:57:44 +08:00
Merge pull request #642 from al-cheb/al-cheb/install_root_ca
Install missing root certificates on windows-2019
This commit is contained in:
22
images/win/scripts/Installers/Install-RootCA.ps1
Normal file
22
images/win/scripts/Installers/Install-RootCA.ps1
Normal file
@@ -0,0 +1,22 @@
|
||||
# Serialized Certificate Store File
|
||||
$sstFile = "$env:TEMP\roots.sst"
|
||||
# Generate SST from Windows Update
|
||||
$result = certutil.exe -generateSSTFromWU $sstFile
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Host "[Error]: failed to generate $sstFile sst file`n$result"
|
||||
exit $LASTEXITCODE
|
||||
}
|
||||
|
||||
$result = certutil.exe -dump $sstFile
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Host "[Error]: failed to dump $sstFile sst file`n$result"
|
||||
exit $LASTEXITCODE
|
||||
}
|
||||
|
||||
try {
|
||||
Import-Certificate -FilePath $sstFile -CertStoreLocation Cert:\LocalMachine\Root
|
||||
} catch {
|
||||
Write-Host "[Error]: failed to import ROOT CA`n$_"
|
||||
exit 1
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user