# Verifying Website Certificates

**URL:** <https://forums.powershell.org/t/verifying-website-certificates/15282>\
**Category:** PowerShell Help\
**Created:** [November 24, 2020, 8:40am UTC](https://forums.powershell.org/t/verifying-website-certificates/15282 "2020-11-24T08:40:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![krieger-bot](https://avatars.discourse-cdn.com/v4/letter/k/51bf81/32.png) [@krieger-bot](https://forums.powershell.org/u/krieger-bot)\
**Post date:** [November 24, 2020, 8:40am UTC](https://forums.powershell.org/t/verifying-website-certificates/15282/1 "2020-11-24T08:40:07Z")

</div>

How can I call a URL and check if its certificate is valid? I’m trying to keep track certificates for my department’s websites, half of which are hosted on Linux machines to which I have no access. The information I’m trying to gather into an eventual report is:

URL, SubjectName, IssuerName, and dates valid (NotAfter, NotBefore)

I don’t understand how to get there from Invoke-WebRequest or Invoke-RESTMethod. I’m not asking for a full script, just a jumping off point.

Thanks,

Patrick

---

<div class="post-metadata">

**Author:** ![matt-bloomfield](https://avatars.discourse-cdn.com/v4/letter/m/dec6dc/32.png) [@matt-bloomfield](https://forums.powershell.org/u/matt-bloomfield)\
**Post date:** [November 25, 2020, 12:51am UTC](https://forums.powershell.org/t/verifying-website-certificates/15282/2 "2020-11-25T00:51:21Z")

</div>

Are these public facing websites or internal only?

If they’re public facing, I think the best route will be to use the [SSL Labs API](https://github.com/ssllabs/ssllabs-scan/blob/master/ssllabs-api-docs-v3.md)

```
$response = Invoke-RestMethod 'https://api.ssllabs.com/api/v3/analyzehost=<www.example.com>&all=on'

foreach ($cert in $response.certs) {

    Write-Output $cert.subject

}
```

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:28pm UTC](https://forums.powershell.org/t/verifying-website-certificates/15282/3 "2024-05-16T20:28:18Z")

</div>


