Automatic certificate renewal on windows

My domain is:

I ran this command: certbot renew --dry-run -pre-hook "net stop Apache2.4" --post-hook "net start Apache2.4"

It produced this output: certbot: error: unrecognized arguments: -pre-hook net stop Apache2.4

My web server is (include version): Apache2.4

The operating system my web server runs on is (include version): Windows 11

My hosting provider, if applicable, is: N/A

I can login to a root shell on my machine (yes or no, or I don't know): yes

I'm using a control panel to manage my site (no, or provide the name and version of the control panel): no

The version of my client is (e.g. output of certbot --version or certbot-auto --version if you're using Certbot): certbot 2.2.0

Given the previous specs of the configuration, i can't get that command to run.

What I want is for certbot to automatically renew the certificates i have. But since, in order to do that, it needs for the webserver to be down, what i want is that the command that stops the webserver and then starts it after the check or renewal works, which i think it's not.

The task added to windows task scheduler isn't working either.

This task lauches Powershell.exe and runs
-NoProfile -WindowStyle Hidden -Command "certbot renew --pre-hook "C:\Windows\System32\net.exe stop Apache2.4" --post-hook "C:\Windows\System32\net.exe start Apache2.4""

How can i solve this?

Thank you in advange for the help provided, kind regards,

Jose Mario Gomes

There's a dash (-) too little in your command. Unfortunately, this seems to be incorrectly written in the Certbot instructions for Windows and Apache.

You also might want to consider something else than the standalone authenticator, I believe the webroot authenticator should also work on Windows.

What doesn't work? What output do you get?


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