HewlettPackard / PowerShell-ProLiant-SDK

PowerShell sample scripts for managing HPE servers
https://www.hpe.com/servers/powershell
90 stars 42 forks source link

Get-HPEiLOCertificateInfo (Module 3.0.0.0) #44

Closed Michel-CO closed 4 years ago

Michel-CO commented 4 years ago

Hey there,

I am currently testing the new version 3.0.0.0 from powershell module for ILO. I found a problem with this new version, when i use the command Get-HPEiLOSSLCertificateInfo on ILO4 Devices.

Example powershell code: $con = Connect-HPEiLO -IP ilofqdn -Username admin -Password $$12345 $return = $con | Get-HPEiLOSSLCertificateInfo

The $return is empty with the new version 3.0.0.0, but when i use the older version 2.2.0.0 i return Data in $return. The $return is filled with newer ILO5. ILO4 FW Version testet 2.72 and also 2.73

how can i find the information from Certificate? I need the Timestamps "ValidNotAfter" and "ValidNotBefore"

Thank you.

Michel

hp-powershell commented 4 years ago

Hi Michel,

This is an issue in 3.0. You can try the below workaround to get the time stamps.

$return = $con | Get-HPEiLOSSLCertificateInfo -OutputType RawResponse

$validNotAfter = [regex]::match($return, 'ValidNotAfter\":(.)\",').Groups[1].value.Trim('"') $validNotBefore = [regex]::match($out, 'ValidNotBefore\":(.)\"},').Groups[1].value.Trim('"')

Both the patterns 'ValidNotAfter\":(.*)\",') is having asterisk within the braces 'ValidNotAfter\":(.asterisk)\",')

Regret the inconvenience caused.

Let us know if you are facing any issues.

Michel-CO commented 4 years ago

Hey,

thanks for the reply. It works.