Reputation: 145
I'm trying to execute the following script on ubuntu machine using PS mode but it shows me nothing, I want to know how can I do have this date. Below is the script that I have wrote:
$var = (Get-ChildItem /etc/ssl/certs)[0].NotAfter
Write-Host $var
Upvotes: 1
Views: 567
Reputation: 200193
PowerShell doesn't magically parse certificate files for you. Use the openssl
command.
$cert = (Get-ChildItem /etc/ssl/certs)[0].FullName
$var = ((& openssl x509 -in $cert -dates -noout) -match 'notAfter').Split('=')[1]
Upvotes: 2