diff --git a/Functions/Setup/Set-NetboxUnstrustedSSL.ps1 b/Functions/Setup/Set-NetboxUnstrustedSSL.ps1 new file mode 100644 index 0000000..e118d1c --- /dev/null +++ b/Functions/Setup/Set-NetboxUnstrustedSSL.ps1 @@ -0,0 +1,19 @@ +Function Set-NetboxUntrustedSSL { + [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseShouldProcessforStateChangingFunctions", "")] + Param( ) + # Hack for allowing untrusted SSL certs with https connections + Add-Type -TypeDefinition @" + using System.Net; + using System.Security.Cryptography.X509Certificates; + public class TrustAllCertsPolicy : ICertificatePolicy { + public bool CheckValidationResult( + ServicePoint srvPoint, X509Certificate certificate, + WebRequest request, int certificateProblem) { + return true; + } + } +"@ + + [System.Net.ServicePointManager]::CertificatePolicy = New-Object -TypeName TrustAllCertsPolicy + +} \ No newline at end of file