Skip to content

Instantly share code, notes, and snippets.

@sewhyte
Created September 6, 2023 13:05
Show Gist options
  • Save sewhyte/cd85dbf2e5add9ed16c4808fc5ab982c to your computer and use it in GitHub Desktop.
Save sewhyte/cd85dbf2e5add9ed16c4808fc5ab982c to your computer and use it in GitHub Desktop.
Get Cert Chain
$url = "https://api.gremlin.com/v1/health"
$WebRequest = [Net.WebRequest]::CreateHttp($url)
$WebRequest.AllowAutoRedirect = $true
$chain = New-Object -TypeName System.Security.Cryptography.X509Certificates.X509Chain
#Request website
$Response = $WebRequest.GetResponse()
#Creates Certificate
$Certificate = $WebRequest.ServicePoint.Certificate.Handle
#Build chain
$chain.Build($Certificate)
$chain.ChainElements.Certificate | Select-Object *
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment