HewlettPackard / PowerShell-ProLiant-SDK

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

Start-HPEiLOCertificateSigningRequest not working with iLO4 2.78 with Get-Culture other than en-US #69

Open Ratnix opened 3 years ago

Ratnix commented 3 years ago

Start-HPEiLOCertificateSigningRequest doesn't seem to work with HPEiLOCmdlets 3.1.0.1 and iLO4 2.78

Tested with: BL460c Gen8, iLO4 2.78 BL460c Gen9, iLO4 2.78

> $(Get-Culture).Name
et-EE
> $VerbosePreference ="Continue"
> $credential = New-Object -TypeName "System.Management.Automation.PSCredential" `
  -ArgumentList "username",$(ConvertTo-SecureString -String "password" -AsPlainText -Force)
> $connection = Connect-HPEiLO -Credential $credential -IP "ilo.host.tld" -DisableCertificateAuthentication
VERBOSE: Executing the cmdlets with 1 task serially.
VERBOSE: [Connect-HPEiLO][ilo.host.tld]: XML Reply on: Reading iLO xml data
VERBOSE: [Connect-HPEiLO][ilo.host.tld]: iLO FirmwareVersion: iLO4 v2,78
VERBOSE: [Connect-HPEiLO][ilo.host.tld]: Product Name: ProLiant BL460c Gen8
VERBOSE: [Connect-HPEiLO][ilo.host.tld]: Creating connection for connection type(s): RIBCL
VERBOSE: [Connect-HPEiLO][ilo.host.tld][RIBCL]: Establishing connection.
VERBOSE: [Connect-HPEiLO][ilo.host.tld][RIBCL]: Received response for create connection request.
VERBOSE: [Connect-HPEiLO][ilo.host.tld][RIBCL]: Connection established.
VERBOSE: [Connect-HPEiLO][ilo.host.tld]: Connection established for connection type(s): RIBCL
> Start-HPEiLOCertificateSigningRequest -Connection $connection -CommonName "ilo.host.tld" -City "City" `
  -Country "TLD" -Organization "Org" -State "State" -OrganizationalUnit "OU" -IncludeiLOIP
VERBOSE: Executing the cmdlets with 1 task serially.
VERBOSE: [Start-HPEiLOCertificateSigningRequest][REST]: REST model is HPE.iLO.Communication.REST.Model.SetModel.
VERBOSE: [Start-HPEiLOCertificateSigningRequest][ilo.host.tld][REST]: Validating Cmdlet supportability.
VERBOSE: [Start-HPEiLOCertificateSigningRequest][ilo.host.tld][REST]: Checking for iLOGeneration, Model and Firmware for Cmdlet Supportability.
VERBOSE: [Start-HPEiLOCertificateSigningRequest][ilo.host.tld][REST]: Forming the error object.

IP           Hostname      Status StatusInfo
--           --------      ------ ----------
192.168.0.10 ilo.host.tld  ERROR HPE.Framework.Core.StatusInfo
> Get-HPEiLOCertificateSigningRequest -connection $connection

IP           Hostname      Status StatusInfo
--           --------      ------ ----------
192.168.0.10 ilo.host.tld  ERROR HPE.Framework.Core.StatusInfo

Works fine with Gen10 iLO5 v2.44 hosts though.

Workaround for iLO4: Doing Set-Culture -CultureInfo en-US and running a new PowerShell session fixes the behaviour. Probably the iLO4 version parser expects dot instead of comma in "v2,78"

CermakPOI commented 3 years ago

Start-HPEiLOCertificateSigningRequest does not work for me for: ProLiant ML350 Gen9 with ILO Version 2.78 Apr 28 2021 I changed Culture and system locale to en-US but then my other Scripts do not work anymore! This also requires a reboot, so cannot cbe changed on the fly in a production environment. So this is a really BAD workaround for this Bug!!

Why don't You use [system.version] objects?

Can you PLEASE fix this!

mpadwick commented 2 years ago

Hi I'm experiencing a similar issue. I have tried:

The script gets stuck in an ever ongoing loop (lower script block). Any ideas are greatly appreciated.

Get-Culture
LCID             Name             DisplayName
----             ----             -----------
1033             en-US            English (United States)

Output from my script:

[verbose] iLO Configured Hostname: server1-ilo.demo.local
[logging] iLO Hostname Matches DNS Record! - Generating CSR...
VERBOSE: Performing the operation "Start-HPEiLOCertificateSigningRequest" on target "server1-ilo.demo.local".
VERBOSE: Executing the cmdlets with 1 task serially.
VERBOSE: [Start-HPEiLOCertificateSigningRequest][server1-ilo.demo.local][Redfish]: Validating Cmdlet supportability.
VERBOSE: [Start-HPEiLOCertificateSigningRequest][server1-ilo.demo.local][Redfish]: Checking for iLOGeneration, Model and Firmware for Cmdlet Supportability.
VERBOSE: [Start-HPEiLOCertificateSigningRequest][server1-ilo.demo.local][Redfish]: Validating parameter supportability.
VERBOSE: [Start-HPEiLOCertificateSigningRequest][server1-ilo.demo.local][Redfish]: Checking for iLOGeneration, Model and Firmware for parameter Supportability.
VERBOSE: [Start-HPEiLOCertificateSigningRequest][server1-ilo.demo.local][Redfish]: Getting url value from resource instance.
VERBOSE: [Start-HPEiLOCertificateSigningRequest][server1-ilo.demo.local][Redfish]: Creating Redfish request.
VERBOSE: [Start-HPEiLOCertificateSigningRequest][server1-ilo.demo.local][Redfish]: Retrieving URL's from parameter mapper.
VERBOSE: [Start-HPEiLOCertificateSigningRequest][server1-ilo.demo.local][Redfish]: Forming JSON payload for corresponding URL.
VERBOSE: [Start-HPEiLOCertificateSigningRequest][server1-ilo.demo.local][Redfish]: Creating Redfish request.
VERBOSE: [Start-HPEiLOCertificateSigningRequest][server1-ilo.demo.local][Redfish]: Sending Redfish request to PATCH/POST/DELETE the JSON payload.
VERBOSE: [Start-HPEiLOCertificateSigningRequest][server1-ilo.demo.local][Redfish]: Processing JSON response.
VERBOSE: [Start-HPEiLOCertificateSigningRequest][server1-ilo.demo.local][Redfish]: Redfish response message: GeneratingCertificate
Waiting for CSR to be generated ...
while(-not ($csr.CertificateSigningRequest)) {
    Write-Host "Waiting for CSR to be generated ..."
    start-sleep -Seconds 60
    $CSR = Get-HPEiLOCertificateSigningRequest -Connection $connection 
  }
hp-powershell commented 1 year ago

Hi

HPEiLOCmdlets have support extended for cultures zh-CN and ja-JP other than en-US.

any other languages , we need to have a check done and also need to be brought to management notice on extending support
we shall do so and we will keep you posted , we are marking this as enhancement here .

Thanks & Regards, Powershell Team

CermakPOI commented 1 year ago

You could just do it the RIGHT way and hard-code the dot . as a version separator! The version is 100% INDEPENDENT of ANY language.

hp-powershell commented 11 months ago

Hi ,

Thanks for the suggestion , we will bring this to the notice of the architect and plan to make changes in our next release planned .

Thanks & regards, Powershell Team