Introduction
win-acme is a Windows ACME client that requests, installs, and renews Let’s Encrypt certificates on Windows Server. You run it on the server, select a target such as an IIS site, complete domain validation through HTTP-01 or DNS-01, and win-acme creates a scheduled task that renews the certificate before it expires. The tool handles certificate requests, private key generation, IIS binding updates, and renewal cycles, which reduces the manual work involved in operating HTTPS on Windows. This guide covers server preparation, win-acme installation, interactive and unattended certificate issuance, validation choices, renewal management, certificate export, and diagnosis of common failures.
Prerequisites and Environment Checks
Before running win-acme, confirm that the Windows Server can reach Let’s Encrypt validation endpoints and that you have the permissions required to create certificates and modify IIS bindings. Most deployments run on IIS with Windows Server 2016, 2019, 2022, or 2025, but win-acme can also issue certificates for services outside IIS when you install the certificate into the Windows certificate store or export it to files. A short set of checks before the first run prevents the most common validation and installation failures.
The account running win-acme needs local administrator privileges. Certificate enrollment writes to the local machine certificate store, and IIS installation updates HTTPS bindings. If you plan to automate renewals through the default scheduled task, the task account also needs enough permission to read the win-acme configuration, access the private key, and update the target service. Running the first issuance manually from an elevated PowerShell session is the safest way to confirm that permissions and network paths are correct.
Network access is equally important. For HTTP-01 validation, Let’s Encrypt must be able to reach your domain on port 80 from the public internet. For DNS-01 validation, the server running win-acme must be able to create or update the required TXT record, either through a DNS provider API or through a script you control. In both cases, outbound HTTPS access to the Let’s Encrypt ACME endpoints is required.
Use these checks to confirm the baseline environment:
# Confirm IIS is installedGet-WindowsFeature -Name Web-Server | Select-Object Name, InstallState
# Confirm the current session is elevated([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
# Check listeners on ports 80 and 443Get-NetTCPConnection -State Listen | Where-Object { $_.LocalPort -in 80, 443 } | Select-Object LocalAddress, LocalPort, OwningProcess
# Confirm the site binding you plan to secureImport-Module WebAdministrationGet-WebBinding | Select-Object protocol, bindingInformationDNS configuration should be verified before requesting a certificate. The hostname in the certificate request must resolve to the server that will answer the validation challenge. A stale A record, an unexpected CDN proxy, or an IPv6 AAAA record pointing to a different host can cause validation to fail even when IIS is configured correctly on the local machine.
# Check DNS resolution from the serverResolve-DnsName -Name "example.com" -Type AResolve-DnsName -Name "www.example.com" -Type A
# Confirm outbound HTTPS connectivityTest-NetConnection -ComputerName "acme-v02.api.letsencrypt.org" -Port 443If the server sits behind a load balancer or reverse proxy, decide where TLS terminates before you issue the certificate. win-acme can install a certificate on the Windows Server running IIS, but it cannot magically fix a topology where port 80 validation reaches a different device. In that case, DNS-01 validation or certificate installation on the edge device may be the better operational choice.
How win-acme and Let’s Encrypt Work
win-acme implements the ACME protocol, which defines how a client proves control over a domain and requests a certificate from a certificate authority. When you start a certificate request, win-acme creates or reuses an ACME account, submits an order for the domain names you selected, and receives challenge instructions from Let’s Encrypt. After the challenge succeeds, Let’s Encrypt issues the certificate, and win-acme installs it according to the store and installation plugins you selected.
The certificate issuance flow has a few practical consequences for Windows administrators. First, domain validation happens at request time and again at renewal time, so the network path that worked during initial setup must remain valid. Second, the private key is generated on the client side, not by Let’s Encrypt. You are responsible for protecting that key in the Windows certificate store or in exported files. Third, automation is part of the design: Let’s Encrypt certificates have a 90-day validity period, so manual renewal is a poor long-term process.
The two validation methods most administrators use with win-acme are HTTP-01 and DNS-01. HTTP-01 proves domain control by serving a token at a predictable path on the domain:
http://example.com/.well-known/acme-challenge/<token>win-acme can answer this challenge by placing a file in the IIS site, by using a temporary self-hosting listener, or by integrating with another supported validation mode. HTTP-01 is simple when the IIS site is publicly reachable on port 80. It does not work for wildcard certificates.
DNS-01 proves domain control by creating a TXT record under the _acme-challenge name:
_acme-challenge.example.com. TXT "token-value"DNS-01 is required for wildcard certificates and useful when port 80 is blocked, when the service is not an HTTP site, or when validation must happen without exposing a web challenge path. The trade-off is operational complexity: you need DNS API credentials or a reliable script, and you need to account for DNS propagation delays.
Let’s Encrypt also applies rate limits to certificate issuance and failed validations. These limits affect how aggressively you can test. During setup, use the Let’s Encrypt staging environment to avoid hitting production limits. Before automating large deployments, review the current limits in the official Let’s Encrypt documentation, because policies and thresholds can change.
Downloading and Verifying win-acme
Download win-acme from the official GitHub releases page for the win-acme/win-acme repository. The release assets include multiple builds, and the right choice depends on your Windows Server version, CPU architecture, and preference for a self-contained or framework-dependent package. For most administrators managing x64 Windows Server hosts, an x64 release build is the practical starting point. Read the release notes for the version you download, because plugin availability and runtime requirements can differ between releases.
Create a dedicated directory for the tool. Keeping win-acme in a stable path such as C:\Tools\win-acme makes scheduled task troubleshooting and script automation easier.
# Create a dedicated installation directoryNew-Item -Path "C:\Tools\win-acme" -ItemType Directory -Force
# Extract the downloaded release archiveExpand-Archive -Path "$env:USERPROFILE\Downloads\win-acme.v2.x.x.x64.pluggable.zip" ` -DestinationPath "C:\Tools\win-acme" ` -Force
# Remove the Mark of the Web from extracted filesGet-ChildItem -Path "C:\Tools\win-acme" -Recurse | Unblock-FileThe archive name in the command is an example. Use the filename that matches the version and build you downloaded. After extraction, inspect the directory and confirm that wacs.exe is present. A typical extracted directory contains the executable, default settings, and supporting files:
C:\Tools\win-acme\├── wacs.exe├── settings.json├── settings_default.json├── public_suffix_list.dat└── Scripts\ ├── ImportExchange.ps1 ├── ImportRDS.ps1 └── ...The exact contents vary by version and build. The Scripts folder is useful as a reference, but you should review any script before using it in production. Many scripts require environment-specific values, service accounts, or certificate thumbprint handling.
Run the executable once to confirm that it starts and to review the available options for your installed version:
Set-Location "C:\Tools\win-acme".\wacs.exe --version.\wacs.exe --helpIf you maintain Windows servers with change control, record the win-acme version, the download source, the checksum if the release provides one, and the installation path. That record makes future renewals and incident response easier to audit. It also helps when you need to compare behavior after an upgrade, because command-line arguments and plugin names have changed across win-acme major versions.
Creating a Certificate for IIS with the Interactive Wizard
The interactive wizard is the most direct way to issue a first certificate because it guides you through target selection, validation, certificate storage, and IIS installation. Run wacs.exe from an elevated PowerShell session on the Windows Server where IIS is installed. Starting with the wizard gives you a working baseline before you move to unattended commands.
Set-Location "C:\Tools\win-acme".\wacs.exeThe menu labels can vary slightly between win-acme versions, but the overall flow is consistent. You choose to create a certificate, select an IIS target, pick the site or bindings, choose a validation method, and confirm the installation steps. A representative session looks like this:
A simple Windows ACMEv2 client (WACS) Software version ... (release build) Please report issues at https://github.com/win-acme/win-acme
N: Create certificate (default settings) M: Create certificate (full options) R: Run renewals (0 currently due) A: Manage renewals (0 total) O: More options... Q: Quit
Please choose from the menu: NWhen prompted for the certificate target, select the IIS option. win-acme can read existing IIS bindings and build the certificate request from them. This is convenient when the site already has HTTP bindings for the domains you want to secure.
Please specify how the list of domain names that will be included in the certificate should be determined.
1: Read bindings from IIS 2: Manual input 3: CSR created by another program C: Abort
How shall we determine the domain(s) to include in the certificate?: 1After selecting IIS bindings, win-acme asks which site to use. For a server hosting multiple sites, select the correct site identifier. Then choose the bindings or hostnames to include in the certificate. Keep the certificate scope deliberate. Including every hostname on a server in one certificate can be convenient, but it also means a validation or renewal problem affects a larger set of names. Separate certificates per site or per service boundary can be easier to reason about.
The wizard then asks for validation and installation options. For a standard public IIS site, HTTP-01 validation with self-hosting or filesystem validation is common. If IIS already listens on port 80 and you want minimal disruption, filesystem validation can work well because it writes the challenge response into the site. If port 80 is occupied in a way that conflicts with the validation method, review the binding and select the method that matches your topology.
At the end of the wizard, win-acme asks you to accept the Let’s Encrypt subscriber terms and provide an email address for account notifications. Use a monitored mailbox or a shared operations address. A personal mailbox tied to a single administrator creates an operational risk when that person changes roles.
After issuance, verify the certificate in both the Windows certificate store and IIS:
# Check the certificate in the Local Machine personal storeGet-ChildItem Cert:\LocalMachine\My | Where-Object { $_.Subject -like "*example.com*" } | Sort-Object NotAfter -Descending | Select-Object Subject, Issuer, NotAfter, Thumbprint, EnhancedKeyUsageList
# Check the IIS HTTPS bindingImport-Module WebAdministrationGet-WebBinding -Name "Default Web Site" -Protocol https | Select-Object bindingInformation, certificateHash, certificateStoreNameAlso test the site from a client machine, not only from the server itself. A browser test confirms the certificate chain, hostname match, and binding. A local test on the server can miss external DNS or firewall problems. If you have OpenSSL available on a workstation, you can inspect the served certificate:
openssl s_client -connect example.com:443 -servername example.com </dev/null | openssl x509 -noout -subject -issuer -datesThe OpenSSL command is optional, but it is useful when a browser shows a generic certificate warning and you need to confirm which certificate the server actually presented.
Automating Certificate Issuance with Command Line Arguments
After you have a working interactive setup, move repeatable deployments to unattended commands. Command-line execution is useful for server provisioning scripts, configuration management, and documented recovery procedures. It also makes the certificate request parameters explicit, which is valuable when another administrator needs to understand how a certificate was issued.
win-acme command-line arguments depend on the installed version. The plugin model changed across major releases, and argument names can differ. Treat .\wacs.exe --help and the reference documentation for your installed version as the authoritative source. The examples below show representative patterns for common IIS and manual scenarios.
For a standard IIS site with HTTP-01 self-hosting validation, a representative command looks like this:
Set-Location "C:\Tools\win-acme"
.\wacs.exe ` --source iis ` --siteid 1 ` --host "example.com" ` --host "www.example.com" ` --validation selfhosting ` --store certificatestore ` --installation iis ` --accepttos ` --emailaddress "admin@example.com"Each argument controls a specific part of the issuance flow. The source defines where win-acme discovers the target names. The host arguments define the domain names to include. The validation argument selects the challenge method. The store argument defines where the issued certificate is placed. The installation argument defines what win-acme should configure after issuance. The acceptance and email arguments handle account registration requirements.
For a manual certificate that you plan to install yourself, you can skip the IIS installation step:
.\wacs.exe ` --source manual ` --host "api.example.com" ` --validation selfhosting ` --store certificatestore ` --installation none ` --accepttos ` --emailaddress "admin@example.com"This pattern is useful when win-acme should obtain and renew the certificate, but another process handles the service binding. For example, you might use a PowerShell script to install the renewed certificate into an application that reads a thumbprint from its configuration file.
When testing unattended commands, use the staging environment first. The staging environment issues certificates that are not trusted by browsers, but it exercises the same ACME flow without consuming production issuance limits. The exact argument for selecting the base URI can vary by version, so check your local help output. In many setups, administrators test by temporarily setting the ACME base URI in settings.json or by passing the appropriate base URI argument supported by their version.
A practical automation pattern is to wrap win-acme in a small PowerShell script that logs output and checks the exit code:
$ErrorActionPreference = "Stop"Set-Location "C:\Tools\win-acme"
$logPath = "C:\Logs\win-acme"New-Item -Path $logPath -ItemType Directory -Force | Out-Null$timestamp = Get-Date -Format "yyyyMMdd-HHmmss"$logFile = Join-Path $logPath "issue-$timestamp.log"
& .\wacs.exe ` --source iis ` --siteid 1 ` --host "example.com" ` --validation selfhosting ` --store certificatestore ` --installation iis ` --accepttos ` --emailaddress "admin@example.com" *>&1 | Tee-Object -FilePath $logFile
if ($LASTEXITCODE -ne 0) { throw "win-acme exited with code $LASTEXITCODE. See $logFile"}The wrapper does not replace win-acme’s own logs. It gives you a deployment-time artifact that fits into your provisioning or CI/CD process. Capture the exit code explicitly. A script that ignores the exit code can report success while certificate issuance failed.
Choosing the Right Validation Method
Validation method selection determines whether renewals will be smooth or fragile. The right choice depends on network topology, DNS control, and certificate scope. The two methods you will use most often with win-acme are HTTP-01 and DNS-01. Both are valid, but they solve different problems.
| Method | Best fit | Requirements | Trade-offs |
|---|---|---|---|
| HTTP-01 | Public IIS sites with reachable port 80 | Domain resolves to the server, port 80 open from the internet, HTTP challenge path can be served | Cannot issue wildcard certificates, sensitive to redirects and proxy topology |
| DNS-01 | Wildcard certificates, internal services, servers without public port 80 | Ability to create _acme-challenge TXT records, DNS API credentials or script, waiting for propagation | More setup, credential management burden, DNS provider API failures affect renewal |
HTTP-01 is usually the simplest option for a standard IIS website. The validation request is clear: Let’s Encrypt fetches a token from the domain over HTTP. If the site already serves public HTTP traffic, you often have the required network path in place. The main failure modes are operational rather than conceptual. A global HTTP-to-HTTPS redirect may interfere depending on how validation is handled. A web application firewall may block the challenge path. A load balancer may route port 80 to a different backend than the one running win-acme.
DNS-01 is more flexible. It works when the server is not directly reachable on port 80, and it is the standard choice for wildcard certificates such as *.example.com. It also separates certificate issuance from web server configuration. That separation can be valuable when you manage many services behind the same DNS zone. The cost is that DNS becomes part of your certificate issuance pipeline. If the DNS API token expires, if the provider rate limits requests, or if propagation is slow, renewals can fail.
When choosing a method, evaluate the renewal path, not only the first issuance. A manual DNS TXT update might be acceptable for a one-time experiment, but it is a poor fit for a 90-day certificate lifecycle. For production DNS-01, use a supported DNS plugin or a tested script that can create and delete TXT records automatically.
A DNS-01 automation flow usually has three parts: a create script, a delete script, and secure credential storage. The exact win-acme arguments depend on the plugin or script integration you use, but the operational model looks like this:
# Example shape for script-based DNS validation.\wacs.exe ` --source manual ` --host "*.example.com" ` --host "example.com" ` --validation script ` --dnscreatescript "C:\Tools\win-acme\Scripts\dns-create.ps1" ` --dnsdeletescript "C:\Tools\win-acme\Scripts\dns-delete.ps1" ` --store certificatestore ` --installation none ` --accepttos ` --emailaddress "admin@example.com"Treat the script names and arguments as a pattern to verify against your installed win-acme version. The important design decision is to keep DNS credentials out of plain text where possible, restrict access to the scripts, and log enough detail to diagnose failures without leaking secrets.
Testing with the Let’s Encrypt Staging Environment
The staging environment is the safest place to test new win-acme configurations. It uses the same ACME protocol flow as production, but the issued certificates are not trusted by browsers. That makes staging ideal for verifying DNS records, HTTP challenge routing, firewall rules, scheduled task permissions, and deployment scripts. It also protects you from production rate limits while you are still debugging.
The production and staging ACME endpoints are different. win-acme includes both in its default settings:
{ "Acme": { "DefaultBaseUri": "https://acme-v02.api.letsencrypt.org/", "DefaultBaseUriTest": "https://acme-staging-v02.api.letsencrypt.org/" }}The exact configuration mechanism for selecting staging can vary by version and by how you run win-acme. Some administrators switch the base URI in settings.json during testing, while others use command-line options supported by their build. Check the help output for your version before relying on a specific flag. The key practice is to make the staging choice explicit and to switch back to production intentionally.
A staging test should follow the same path as production. Use the same hostname, the same validation method, the same IIS site, and the same installation target if possible. A test that uses a different validation method proves very little about the production renewal path. After a successful staging issuance, inspect the certificate issuer and expiration:
Get-ChildItem Cert:\LocalMachine\My | Where-Object { $_.Subject -like "*example.com*" } | Sort-Object NotAfter -Descending | Select-Object -First 1 Subject, Issuer, NotBefore, NotAfter, ThumbprintA staging certificate will show a staging issuer rather than a trusted Let’s Encrypt production issuer. That is expected. Once the staging flow works, remove the staging certificate or keep it clearly labeled so it is not confused with a production certificate during troubleshooting.
Staging is also useful when you change infrastructure. If you move a site behind a new reverse proxy, change DNS providers, or modify IIS rewrite rules, run a staging issuance before you trust the next production renewal window. This small step catches validation regressions early.
Managing Renewals and Scheduled Tasks
Issuing the first certificate is only half of the job. The operational value of win-acme comes from renewals running without manual intervention. During certificate creation, win-acme can register a Windows Scheduled Task that checks renewals on a regular schedule. You should verify that task, understand where logs are written, and test a renewal run before you consider the deployment complete.
Start by locating the scheduled task:
Get-ScheduledTask | Where-Object { $_.TaskName -like "*win-acme*" } | Select-Object TaskName, State, Author
Get-ScheduledTask | Where-Object { $_.TaskName -like "*win-acme*" } | Get-ScheduledTaskInfo | Select-Object TaskName, LastRunTime, LastTaskResult, NextRunTimeThe task name may include the ACME endpoint or other version-specific details. Use a wildcard search instead of assuming an exact name. Inspect the task action and principal in Task Scheduler or with PowerShell. The action should point to the correct wacs.exe path, and the principal should have the permissions required to renew and install the certificate.
A manual renewal check is useful after installation and after server changes:
Set-Location "C:\Tools\win-acme"
# Check renewals due under normal rules.\wacs.exe --renew
# Force renewal for testing (use staging or understand rate limits first).\wacs.exe --renew --forceBe careful with forced renewals against the production Let’s Encrypt endpoint. Forced renewals are useful for validation, but repeated forced runs can hit rate limits. Use staging for repeated tests. In normal operation, win-acme should renew certificates when they are due based on its configured renewal window.
Logs are the first place to look when a renewal fails. win-acme writes logs and renewal configuration data to its configuration path. The default location is commonly under ProgramData, but it can be influenced by settings and installation choices. Check both the installation directory and the ProgramData path:
Get-ChildItem "C:\Tools\win-acme" -Recurse -File | Where-Object { $_.FullName -match "\\log\\|\\.log$" } | Select-Object FullName, LastWriteTime
Get-ChildItem "C:\ProgramData\win-acme" -Recurse -File -ErrorAction SilentlyContinue | Select-Object FullName, LastWriteTime, LengthRenewal configuration files are as important as the certificate itself. They describe how win-acme should renew the certificate, which validation method to use, and where to install the result. Back them up as part of your server configuration backup. A server restore that brings back IIS but loses win-acme renewal metadata can leave you with certificates that expire unexpectedly.
You should also monitor renewal outcomes. A scheduled task that exists is not the same as a scheduled task that succeeds. At minimum, review task history and win-acme logs periodically. In larger environments, forward task failures or log events to your monitoring system. Certificate expiration monitoring from an external probe is a good second layer because it catches failures even when the local task scheduler is broken.
Certificate Store, IIS Bindings, and File Exports
Understanding where win-acme places certificates helps you avoid confusion during troubleshooting and migrations. On Windows, certificates are commonly stored in the Local Machine personal store. IIS bindings reference a certificate by thumbprint and store name. When win-acme renews a certificate, it can install the new certificate and update the IIS binding, but only if the installation step is configured correctly and the task has permission.
You can inspect the installed certificate and its properties with PowerShell:
Get-ChildItem Cert:\LocalMachine\My | Where-Object { $_.Subject -like "*example.com*" } | Sort-Object NotAfter -Descending | Select-Object -First 1 ` Subject, FriendlyName, NotBefore, NotAfter, Thumbprint, HasPrivateKey, @{Name="KeyAlgorithm";Expression={$_.PublicKey.Oid.FriendlyName}}For IIS, confirm that the HTTPS binding points to the expected thumbprint:
Import-Module WebAdministrationGet-WebBinding -Protocol https | ForEach-Object { [PSCustomObject]@{ Name = $_.ItemXPath Binding = $_.bindingInformation Thumbprint = $_.certificateHash Store = $_.certificateStoreName SslFlags = $_.sslFlags } }If the binding still points to an old thumbprint after renewal, the renewal may have obtained a certificate but failed during installation. This is a common situation when the scheduled task runs under an account that can read the renewal configuration but cannot modify IIS. The logs will usually show the issuance step and the installation step separately.
Some services cannot read directly from the Windows certificate store in the way IIS does, or they require a PFX or PEM file. win-acme supports different store and installation options depending on version and plugins. You can also export the certificate manually. When exporting, protect the private key carefully.
$cert = Get-ChildItem Cert:\LocalMachine\My | Where-Object { $_.Subject -like "*example.com*" } | Sort-Object NotAfter -Descending | Select-Object -First 1
$exportPath = "C:\Certificates"New-Item -Path $exportPath -ItemType Directory -Force | Out-Null
$password = Read-Host -AsSecureString "Enter PFX export password"Export-PfxCertificate -Cert $cert -FilePath "$exportPath\example.com.pfx" -Password $passwordRestrict access to the export directory. A PFX file contains the private key when exported with the private key included. Leaving it in a broadly readable folder creates an avoidable security risk. If you use the exported certificate in another service, document the dependency so renewals update that service as well. A renewed certificate in the Windows store does not automatically update a copy that was exported months earlier.
For more advanced IIS setups, you may encounter Centralized SSL Certificate Store configurations. win-acme can work with different store strategies, but the operational model changes. Instead of binding a certificate from the local machine store by thumbprint, IIS reads certificate files from a shared location. This can be useful on IIS farms, but it introduces file share permissions, naming conventions, and synchronization concerns. Choose it only when the farm architecture justifies it.
Complete Configuration Example
A maintainable win-acme deployment keeps binaries, configuration, logs, and operational scripts in predictable locations. The exact paths can vary, but a clear structure makes renewals easier to support. The following layout is a practical example for a single Windows Server running IIS:
C:\Tools\win-acme\├── wacs.exe├── settings.json├── settings_default.json├── public_suffix_list.dat└── Scripts\ ├── deploy-certificate.ps1 └── dns-hooks\
C:\ProgramData\win-acme\├── acme-v02.api.letsencrypt.org\│ ├── Certificates\│ ├── Renewals\│ └── ...
C:\Logs\win-acme\├── issue-20261124-093000.log└── renewal-checks.logThe ProgramData structure shown here is representative. Your version may use different folder names. The important point is to know where renewal metadata lives and to include it in backups.
Use settings_default.json as the baseline for configuration changes. Copy it to settings.json only when you need to override defaults, and keep the file small. A minimal configuration that adjusts renewal scheduling and leaves most defaults intact is easier to upgrade than a heavily customized file.
{ "Client": { "ClientName": "win-acme", "VersionCheck": false }, "Acme": { "DefaultBaseUri": "https://acme-v02.api.letsencrypt.org/", "DefaultBaseUriTest": "https://acme-staging-v02.api.letsencrypt.org/" }, "ScheduledTask": { "RenewalDays": 55, "RandomDelay": "04:00:00", "StartBoundary": "09:00:00", "ExecutionTimeLimit": "02:00:00" }}Review every key against the settings_default.json shipped with your version before applying changes. Do not copy old configuration snippets from random scripts without checking compatibility. win-acme settings have evolved, and an unsupported key can be ignored or cause confusing behavior.
For operational scripts, keep a simple deployment wrapper that records the command, output, and exit code. The wrapper below is an example you can adapt for a single IIS site:
param( [Parameter(Mandatory = $true)] [string]$PrimaryHost, [string[]]$AdditionalHosts = @(), [int]$SiteId = 1, [string]$EmailAddress = "admin@example.com")
$ErrorActionPreference = "Stop"$winAcmePath = "C:\Tools\win-acme"$logDir = "C:\Logs\win-acme"New-Item -Path $logDir -ItemType Directory -Force | Out-Null
$timestamp = Get-Date -Format "yyyyMMdd-HHmmss"$logFile = Join-Path $logDir "issue-$($PrimaryHost.Replace('*','wildcard'))-$timestamp.log"
$arguments = @( "--source", "iis", "--siteid", "$SiteId", "--host", $PrimaryHost, "--validation", "selfhosting", "--store", "certificatestore", "--installation", "iis", "--accepttos", "--emailaddress", $EmailAddress)
foreach ($hostName in $AdditionalHosts) { $arguments += @("--host", $hostName)}
Set-Location $winAcmePath& .\wacs.exe @arguments *>&1 | Tee-Object -FilePath $logFile
if ($LASTEXITCODE -ne 0) { throw "win-acme failed with exit code $LASTEXITCODE. Review $logFile"}This script is intentionally small. It does not try to abstract every win-acme feature. Its value is that it makes the issuance parameters visible and repeatable. If your environment requires DNS-01, Centralized SSL, or custom installation hooks, create separate scripts for those cases instead of building one script with many hidden branches.
Troubleshooting Common win-acme and ACME Errors
Certificate issuance failures usually fall into a few categories: validation path problems, DNS problems, rate limits, permissions, or installation errors after the certificate has been issued. The fastest way to troubleshoot is to read the win-acme log, identify which phase failed, and test that phase directly.
HTTP-01 challenge cannot be reached
A common error looks like this:
[example.com] Authorization result: invalid[example.com] {"type":"urn:ietf:params:acme:error:connection","detail":"...: Fetching http://example.com/.well-known/acme-challenge/...: Timeout during connect (likely firewall problem)"}This error means Let’s Encrypt could not fetch the challenge token from your domain. The cause is often outside win-acme. Check DNS resolution, public firewall rules, Windows Firewall, load balancer routing, and IIS bindings. Confirm that port 80 reaches the same server where win-acme is creating the challenge response.
A quick local test helps separate local IIS problems from external network problems:
# Create a temporary test file in the site root if using filesystem validation$sitePath = "C:\inetpub\wwwroot"New-Item -Path "$sitePath\.well-known\acme-challenge" -ItemType Directory -Force | Out-NullSet-Content -Path "$sitePath\.well-known\acme-challenge\test.txt" -Value "ok"
# Test locallyInvoke-WebRequest -Uri "http://example.com/.well-known/acme-challenge/test.txt" -UseBasicParsingIf the local request works but the public validation fails, focus on external routing. If the local request fails, check IIS bindings, site path, URL Rewrite rules, and whether another process owns port 80.
Validation fails because of redirects or rewrites
Another frequent HTTP-01 issue appears as an invalid authorization even