Using certbot renew with pre-/posthook in windows 10 shows error

I set it to Unrestricted for testing. And same error. And Unrestricted is not a solution.

1 Like

So, I've now spent half my weekend investigating all of this in more detail. The results:

  1. It has nothing to do with WinNMP. The error also occurs with an empty bat file, so it is completely independent of the command.

  2. It's not my computer. Your installer will be able to run the file "D:\Users\Itsme\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1" without any problems. At the end of the installation, the file "C:\Program Files (x86)\Certbot\renew-up.ps1" (and in this also "C:\Program Files (x86)\Certbot\renew-down.ps1") is executed . Before that "D:\Users\Itsme\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1" is run without any problems.

  3. As I suspected, changing the call

"C:\Program Files (x86)\Certbot\Python\python.exe" -c "import subprocess; print(subprocess.run(['powershell.exe', ' -Command', 'D:/WinNMP/WinNMP.exe /s'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=False, universal_newlines=False))"

to

"C:\Program Files (x86)\Certbot\Python\python.exe" -c "import subprocess; print(subprocess.run(['powershell.exe', '-NoProfile', ' -Command', 'D:/WinNMP/WinNMP.exe /s'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=False, universal_newlines=False))"

solves the "ExecutionPolicy" problem.

C:\WINDOWS\system32>"C:\Program Files (x86)\Certbot\Python\python.exe" -c "import subprocess; print(subprocess.run(['powershell.exe', '-NoProfile', '-Command', 'D:/WinNMP/WinNMP.exe /s'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=False, universal_newlines=False))"
CompletedProcess(args=['powershell.exe', '-NoProfile', '-Command', 'D:/WinNMP/WinNMP.exe /s'], returncode=0, stdout=b'', stderr=b'')

Unfortunately, I can't fix the fact that the command waits for ALL the programs started to finish. Even if I put them in a bat file that immediately exits. I'm not very familiar with python, sorry.

  1. The problem must be known in your house. The command line in the task scheduler is "'Powershell.exe' -Argument '-NoProfile -WindowStyle Hidden -Command "certbot renew"'"!

So 3 problems remain.

  1. UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 138
  2. AttributeError: 'NoneType' object has no attribute 'strip'
  3. Certbot waits for all files started in the script to finish. That makes sense for pre-hook, but actually not for post-hook. At least certbot should only wait for the end of the script and not for the end of all programs started in the script.

And I found a new problem, sorry.

  1. Certbot does not support paths with spaces. Examples:
--pre-hook "C:\A test\a.bat"
--pre-hook '"C:\A test\a.bat"'
--pre-hook """C:\A test\a.bat"""
--pre-hook "\"C:\A test\a.bat\""

Everything doesn't work.

That's it for now.

2 Likes