You can access the certificate store using MMC or using CertMgr.msc command.
This will show you all certificates in the Local Machines Personal Store:
1 | PS C:\Users\catafest> Get-ChildItem -path cert:\LocalMachine\My |
This will show info about one certificate result on the first PowerShell command:
1 2 3 4 5 6 7 8 | PS C:\Users\catafest> Get-ChildItem Cert:\LocalMachine\My\XXX | Select @{N='StartDate';E={$_.NotBefore}}, >> @{N='EndDate';E={$_.NotAfter}}, >> @{N='DaysRemaining';E={($_.NotAfter - (Get-Date)).Days}} >> StartDate EndDate DaysRemaining --------- ------- ------------- 6/2/2019 8:17:27 AM 6/2/2022 8:17:27 AM -24 |
Also, you can test many PowerShell commands about certificates, like:
1 2 3 4 | PS C:\Users\catafest> Get-PSDrive cert | ft -AutoSize PS C:\Users\catafest> Get-ChildItem Cert:\LocalMachine\Root\ | where{$_.Friendly Name -eq 'DigiCert'} ... |
For the remote servers, we can use Invoke-Command, the below example will get the certificates from the remote servers, see this command:
1 2 3 | Invoke-Command -ComputerName Test1Comp, Test2Comp -Scriptblock{ Get-ChildItem Cert:\LocalMachine\root | where{$_.FriendlyName -eq 'DigiCert'} } |