Last active
April 29, 2016 07:01
-
-
Save dazfuller/2119f452ea88f2bacdc8b67e431fdbc9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
If (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { | |
Write-Error "Need to run as an administrator" | |
return -1 | |
} | |
$source = "https://letsencrypt.org/certs/lets-encrypt-x3-cross-signed.pem" | |
$file = $source.Split("/")[-1] | |
$out = Join-Path "$($env:USERPROFILE)\Downloads" -ChildPath $file | |
Invoke-WebRequest -Uri $source -OutFile $out | |
$args = @( | |
"-trustcacerts" | |
"-keystore" | |
'"' + $($env:JAVA_HOME) + '\lib\security\cacerts"' | |
"-storepass" | |
"changeit" | |
"-noprompt" | |
"-importcert" | |
"-file" | |
$out | |
) | |
$process = Start-Process -FilePath $env:JAVA_HOME\bin\keytool.exe -ArgumentList $args -Wait -PassThru -NoNewWindow |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This assumes that the JAVA_HOME environment variable is set correctly and that keytools.exe is found under it's \bin directory