This post became possible due to the work done by these 2 persons:Laurie Rhodes and of course Vadims Podans
So don’t thank me for the “hard work” thank me only for the little adjustments that needed to be done to make this working…

So, the problem: Set up WinRM over HTTPs, so that you can securely remote manage a window server with WinRM and Powershell. Since we are sometimes cheap, we like to use a self signed certificate and work with firewalled servers so that not every1 can connect to the WinRM if they like to.
We once have set up WinRM on our remote server with a self signed certificate, but that worked for only 1 year and a few weeks/months. I say AND a few weeks/month because of the Spooky Certificate issue.
So today we ran into the issue that when trying to connect to our remote server we get this error:
WinRM testing failed with the following error:

Connecting to remote server XXX.XXX.XXX.XXX failed with the following error message: The server certificate on the destination computer (XXX.XXX.XXX.XXX:5986) has the following errors: The SSL certificate is expired.

Trying to renew this certificate is not easy, to I search together with my friend Google for a #HowToFixThis 🙂

Firstly, you need to remove the WinRM listener using the expired certificate :

Open an elevated command prompt or PowerShell prompt.

View the currently existing listener with the following command:

winrm get winrm/config/listener?Address=*+Transport=HTTPS

The CertificateThumbprint will match what is seen on the certificate.

To remove the listener use the following command:

winrm delete winrm/config/Listener?Address=*+Transport=HTTPS

Secondly: Remove the expired certificate with MMC

Click Run, then type MMC.

Go to File > Add/Remote Snap-in.

Select Certificates then click Add.

Select the Computer Account option.

In the left-hand pane, expand Certificates > Personal > Certificates.

Right-click the certificate and click Delete.

Now, creating the certificate: I need to use the Enhanced version of the, due to limitations in the Windows 2012 New-SelfSignedCertificate Powershell Module.
Download New-SelfSignedCertificateEx.zip
Extract in to a folder somewhere (eg: D:\Tools)
Open and run in an Admin PS console:

Import-Module D:\Tools\New-SelfSignedCertificateEx.ps1

Create a 2nd file D:\Tools\CreateWinRMCert.ps1 with the following content:
Note: change 2 things in this script if wanted:
* On line that start with: New-SelfSignedCertificateEx -NotAfter (Get-Date).AddMonths(60)
to a value that you like. By default, not adding this variable, yournew certificate wil be valid for 12 months only.
* At the end of the script, change your export password-ExportPassword "S3cr3tP4ssw0rd"

Use the PFX generated in C:\Users\Administrator\AppData\Local\Temp\2 to import in your Client Server, using the Password provided above.
After Generating this Certificate, you need to configure the WinRM to use this certificate:

After digging into this, it seems that it has to do with the fact that PATH_INFO is not used in in apache 2.4.11+’s mod_proxy_fcgi: see Apache mod_proxy_fcgi
where you can read:

When configured via ProxyPass or ProxyPassMatch,
mod_proxy_fcgi will not set the PATH_INFO environment variable.
This allows the backend FCGI server to correctly determine SCRIPT_NAME and Script-URI and be compliant with RFC 3875 section 3.3.
If instead you need mod_proxy_fcgi to generate a "best guess" for PATH_INFO, set this env-var.
This is a workaround for a bug in some FCGI implementations.
This variable can be set to multiple values to tweak at how the best guess is chosen (In 2.4.11 and later only):

To make sure that simplesaml works, without breaking anything else that “fixes paths”, I configured mod_proxy_fcgi by creating a /etc/apache2/mods-enabled/proxy_fcgi.conf file containing: