I use a powershell script to check the expiration date of certificates. To to so, I use the code below. The script used to work perfectly for a long time but now fails. When