Renew Certificate in Windows Server 2012 R2

Hello Support,

We have configured Let’s Encrypt certificate on Windows Server 2012 R2.

We have also create the task scheduler and assign auto renew batch file, so it will automatically renew certificate before 30 days expiration of it. But it is not working automatically. If we run the batch file manually then it update the certificate date in file. But we require should done automatically.

So please suggest how we can make this schuduler work automatically.

Thank you.

Which ACME client did you use in your scheduled task … ?

Hello,

We have used AutoACME 1.5.4 version. We have followed stpes mentioned in below link.

We have auto-renew.bat file for new certificate if we run this file manually then it update certificate JSON file. But we want to do it automatically using task scheduler.

We have scheduler by specify this batch file, it is execute on time but it is show 0x1 error instead of success message. So we want to update certificate automatically using task scheduler.

Hopefully you understand it. Please help us to fix this.

Thank You for your time.

Hi @malanisourabh

aren't there more error messages?

Did you check the Windows event log if the task works?

Looks more like a Windows task problem. Perhaps insufficient rights.

I don’t normally outright promote my own software, but sometimes I do/should: https://certifytheweb.com

There lots of great command line tools for ACME on windows, but sometimes a GUI just helps. If you need CCS we don’t do that currently, but otherwise it probably has everything you need (auto renewal is coordinated using a background service that can perform retries etc and can even email you to tell you renewals have started failing).

Hello @JuergenAuer,

Thank you for your reply.

I checked the windows event log, but not find the any additional error message.

I created the task scheduler using administrator credentials.

Can you please specify what permission is missing.

Thank you

It's a Windows-standard-problem that a task use another environment. So commands don't work.

Create a batch or -cmd-file, start that instead of your current command.

Then add things like directory creation to test, if the task is executed.

Does your task look like this?:
task

Also check the task history tab for more details.
If history is disabled, enable it: https://stackoverflow.com/questions/11013132/how-can-i-enable-the-windows-server-task-scheduler-history-recording

Hello @rg305,

Thank you for your reply.

Yes, We have created task like you shared images. It is created by using administrator.

But when it runs on schedule time then it shows 0x1 message instead of successfully message like attached screenshot.

We have enabled the history. It is showing task complete message in history.

So it is not showing same message in task list and history. We checked it is not executing the attached batch file.

Please suggest which setting is missing regarding this.

Thank you

I don’t mind reviewing the scheduled task settings with you.
Go ahead and send me a PM with screenshots of all the tabs/settings.

Hello @rg305,

Thank you for your reply,

As per you suggest I taken the screenshots of tabs of scheduler. I shared these on below link.

https://drive.google.com/open?id=16QksXqj8iEovx2Gyj5qNrephaRrANNr4

When we run the attached batch file i.e auto-renew.bat manually then it runs properly.

Please check this and provide if any setting is missing so it works on scheduler as well,

Thank you

I don’t see anything wrong with the scheduled task.
If you can, please show the auto-renew.bat [you can hide any private info].

Hello @rg305,

Thank you for your reply.

As per you require auto-renew batch file. I shared it on below link.

https://drive.google.com/open?id=10cQRGIHX11bEjB87tJFOOH83BIX7td2P

Please check this and suggest if you find anything related to this.

Thank You

I’m uncertain if it will make much difference…
But it surely won’t hurt; and it is really the only thing I can see of any significant difference:

I would rename the file as a CMD file instead of a BAT file. [Which also requires updating the task action to reflect your new file name: “auto-renew.cmd”].
And also, inside the CMD file, I would call the renewal command explicitly/directly:
Like:
c:\folder\subfolder\autoacme renew
Or maybe also update the task action to “Start In (Optional)” to: c:\folder\subfolder

[a bit obvious, but worth mentioning so all can understand, Use the actual path location of your autoacme file]

Hello @rg305,

Thank you for your reply.

As per your suggestion followed below steps.

  • Renamed the batch file as “autoacme renew.bat”.
  • Specified the full path in “Start In” field.

After making this changes task scheduler runs properly and showed “The operation completed successfully”. So now this is fixed and working properly.

Thank you for all your support.

Renamed to .bat or .cmd ?

Either way, I’m glad to here it now works when called by the Windows Task Scheduler.

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