Upgrade powershell code to ACMEv2 protocol

Hi,
i use ACMESharp via power shell to create multiple domains per certificates
How can i rewrite this code below?

#install-Module -Name ACMESharp

import-module ACMESharp

$email = "mailto:admin@admin.com"
$iissitename = "websitename"
$certname = "aaa15$(get-date -format yyyy-MM-dd--HH-mm)"
$pfxfile = "C:\Certs\03\pfx\$certname.pfx"

$initializevault = $FALSE
$createregistration = $FALSE
$createalias = $TRUE


$domains = @(<...list of domains...>			
	)

$aliases = @()

# Change to the Vault folder
cd C:\ProgramData\ACMESharp\sysVault

# First time on the machine - intiialize vault
if($initializevault) 
{
    Initialize-ACMEVault
}

Get-ACMEVault

if($createregistration) 
{
    # Set up new 'account' tied to an email address
     New-AcmeRegistration -Contacts "$email" -AcceptTos
}
For ($i=0; $i -lt $domains.Length; $i++) {
	 
		$aliases += @($domains[$i]+$(get-date -format yyyyMMddHHmm))
		# Associate a new site 
		New-AcmeIdentifier -Dns $domains[$i] -Alias $aliases[$i]
		#New-ACMEIdentifier -Dns $domain2 -Alias $alias2

		# Prove the site exists and is accessible => (This creates files at .well-known\acme-challenge folder)
		Complete-ACMEChallenge $aliases[$i] -ChallengeType http-01 -Handler iis -HandlerParameters @{WebSiteRef="$iissitename"} -Force
		#Complete-ACMEChallenge $alias2 -ChallengeType http-01 -Handler iis -HandlerParameters @{WebSiteRef="$iissitename"} -Force

		# Validate site
		Submit-ACMEChallenge $aliases[$i] -ChallengeType http-01 -Force
		#Submit-ACMEChallenge $alias2 -ChallengeType http-01 -Force

		# check until valid or invalid - pending =>(Just check the status field)
		Update-ACMEIdentifier $aliases[$i] -ChallengeType http-01
		#Update-ACMEIdentifier $alias2 -ChallengeType http-01 
	
}

Hi,

You can open an issue with ACMESharp’s repo in the link below as they are more familiar with their code.

Thank you

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.