Skip to content

Instantly share code, notes, and snippets.

@ngbrown
Created April 27, 2021 23:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ngbrown/c02f5c9eec00b0adb31ea7c58676a719 to your computer and use it in GitHub Desktop.
Save ngbrown/c02f5c9eec00b0adb31ea7c58676a719 to your computer and use it in GitHub Desktop.
Download root certs for offline computer
certutil -syncwithwu -f -f .\certs
$certFiles = Get-ChildItem "$PSScriptRoot\certs\*.crt"
$certCommands = $certFiles | %{'certutil -addstore root "%~dp0certs\' + $_.Name + '"'}
extrac32 /Y .\certs\authrootstl.cab .\certs\authroot.stl
extrac32 /Y .\certs\disallowedcertstl.cab .\certs\disallowedcert.stl
extrac32 /Y .\certs\pinrulesstl.cab .\certs\pinrules.stl
$outputCmdPath = "$PSScriptRoot\update-certs.cmd"
'REM Run on target computer' | Out-File -Encoding ASCII $outputCmdPath
$certCommands | Out-File -Encoding ASCII -Append $outputCmdPath
'certutil -addstore -f root "%~dp0certs\authroot.stl"' | Out-File -Encoding ASCII -Append $outputCmdPath
'certutil -setreg chain\PinRules "@%~dp0certs\pinrules.stl"' | Out-File -Encoding ASCII -Append $outputCmdPath
'' | Out-File -Encoding ASCII -Append $outputCmdPath
'REM Windows 7 is importing primary signing certificates.' | Out-File -Encoding ASCII -Append $outputCmdPath
'REM certutil -addstore -f disallowed "%~dp0certs\disallowedcert.stl"' | Out-File -Encoding ASCII -Append $outputCmdPath
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment