Hi Guys,
Yeah. It is basic. But after hours of searching the internet. No luck -
Using the Posh-ACME
I thought you could do -
Get-PAOrder | Complete-PAOrder
And it would download the certificate.. But no luck. Or if it does, whre did it save too? Someone please tell me, at wits end ![]()
If you need more details - I wrote this -
Define certificate storage path
$certPath = "D:\Certificates\fullchain.pem"
$privateKeyPath = "D:\Certificates\privkey.pem"
Prompt for email and domain
$email = Read-Host "Enter your email address"
$domain = Read-Host "Enter the domain for the certificate"
Check if Posh-ACME module is installed
if (-Not (Get-Module -ListAvailable -Name Posh-ACME)) {
Write-Host "Posh-ACME module not found. Installing Posh-ACME..."
Install-Module -Name Posh-ACME -Force -Scope CurrentUser
}
Import the Posh-ACME module
Import-Module Posh-ACME
Check if a valid certificate already exists for the domain
Write-Host "Checking if a valid certificate exists for the domain: $domain..."
$existingCert = Get-PACertificate -List | Where-Object { $_.MainDomain -eq $domain }
if ($existingCert) {
# A valid certificate exists; export it to the specified paths
Write-Host "A valid certificate already exists. Downloading the certificate..."
Copy-Item -Path $existingCert.FullChainPem -Destination $certPath -Force
Copy-Item -Path $existingCert.PrivateKeyPem -Destination $privateKeyPath -Force
Write-Host "Certificate files have been saved:"
Write-Host "Certificate Path: $certPath"
Write-Host "Private Key Path: $privateKeyPath"
} else {
# No valid certificate exists; request a new one
Write-Host "No valid certificate found. Requesting a new certificate..."
$certArgs = @{
Contact = @($email) # Pass the email as an array (since Contact can be an array)
AcceptTOS = $true # Accept the terms of service
}
$cert = New-PACertificate -Domain $domain @certArgs
# Export the new certificate to the specified paths
Write-Host "Exporting new certificate to specified paths..."
Copy-Item -Path $cert.FullChainPem -Destination $certPath -Force
Copy-Item -Path $cert.PrivateKeyPem -Destination $privateKeyPath -Force
Write-Host "Certificate files have been saved:"
Write-Host "Certificate Path: $certPath"
Write-Host "Private Key Path: $privateKeyPath"
}
Thanks!
Brad