powershell_cheat_sheet
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
powershell_cheat_sheet [2021/02/18 06:54] – [Get Install-Module working behind a webproxy] stephen | powershell_cheat_sheet [2021/04/13 21:53] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 59: | Line 59: | ||
</ | </ | ||
- | ===== Search installed certs for thumbprint | + | ===== Certificates |
+ | |||
+ | Search by thumbprint: | ||
<code powershell> | <code powershell> | ||
Line 69: | Line 71: | ||
<code powershell> | <code powershell> | ||
Get-ChildItem -Path Cert: -Recurse | Where-Object { $_.Thumbprint -and $_.Thumbprint.ToLower().StartsWith(' | Get-ChildItem -Path Cert: -Recurse | Where-Object { $_.Thumbprint -and $_.Thumbprint.ToLower().StartsWith(' | ||
+ | </ | ||
+ | |||
+ | To check for expired / revoked certs: | ||
+ | |||
+ | <code powershell> | ||
+ | $certs = Get-ChildItem -Path Cert: | ||
+ | foreach ($cert in $certs) { | ||
+ | Write-Host " | ||
+ | |||
+ | if ($certs.NotAfter -lt (Get-Date)) { | ||
+ | Write-Host " | ||
+ | } | ||
+ | elseif ($cert | Test-Certificate) { | ||
+ | Write-Host " | ||
+ | } | ||
+ | } | ||
</ | </ | ||
powershell_cheat_sheet.1613631243.txt.gz · Last modified: 2021/02/19 07:54 (external edit)