Check machine status, if back online - continue, if not - wait and check again

Hi!

Thanks for keeping in touch! @Alex.Rolley was able to provide some pointers. Here is a previous post where he helped a customer achieve the same kind of outcome: How to Gracefully Handle a Reboot Step In Deploy Project

And here is the PowerShell script body:

if (-not ([System.Management.Automation.PSTypeName]'ServerCertificateValidationCallback').Type)
{
$certCallback = @"
    using System;
    using System.Net;
    using System.Net.Security;
    using System.Security.Cryptography.X509Certificates;
    public class ServerCertificateValidationCallback
    {
        public static void Ignore()
        {
            if(ServicePointManager.ServerCertificateValidationCallback ==null)
            {
                ServicePointManager.ServerCertificateValidationCallback += 
                    delegate
                    (
                        Object obj, 
                        X509Certificate certificate, 
                        X509Chain chain, 
                        SslPolicyErrors errors
                    )
                    {
                        return true;
                    };
            }
        }
    }
"@
    Add-Type $certCallback
 }
[ServerCertificateValidationCallback]::Ignore()

(Invoke-WebRequest -method head -Uri "https://localhost:10833").statuscode

Hope that helps!
Mike

1 Like