j81blog / GenLeCertForNS

This script helps you to create a Let's Encrypt certificate for your NetScaler
GNU General Public License v3.0
39 stars 16 forks source link

Powershell 7 #3

Open gbeifuss opened 4 years ago

gbeifuss commented 4 years ago

Running this script under PS 7 generates this error:

2020-06-18 13:05:31:2726    INFO    DNS-VALIDATION  Checking non-matching DNS Records
2020-06-18 13:05:31:2997    INFO    DNS-VALIDATION  All IP Addresses match.
2020-06-18 13:05:31:3125    INFO    CHECKORDERVALIDATION    Checking if validation is required.
2020-06-18 13:05:32:2342    INFO    CHECKORDERVALIDATION    Validation IS required.
2020-06-18 13:05:32:2735    INFO    CONFIGUREADC    Trying to login into the Citrix ADC.
2020-06-18 13:05:32:3072    ERROR   CONFIGUREADC    Could not configure the ADC. Exception Message: Exception calling "CompileAssemblyFromSource" with "2" argument(s): "Operation is not supported on this platform."
2020-06-18 13:05:32:5752    INFO    FINAL   Script Terminated, ExitCode: 1

I launched PS 5.1 and everything completed successfully. I'm opening this request so that PS 7 compatibility can be introduced eventually.

gbeifuss commented 3 years ago

Powershell 7 (and before it, Powershell 6) are based on .NET CORE, which doesn't deliver a compiler anymore in its base installation.

https://github.com/MScholtes/PS2EXE/issues/14#issuecomment-658747358

j81blog commented 3 years ago

Thank you, have not yet had the time to get into that.

phonon00 commented 1 year ago

Also see this error in pwsh 7.x, but not in 5.1

Validation
 -Attempt...................: 1

Certificates
 -Status....................: ****Export-PfxCertificate: Cannot export non-exportable private key.
*****Get-Content: D:\PS\GenLeCertForNS.ps1:4772
Line |
4772 |  … :ToBase64String($(Get-Content $CertificatePfxFullPath -AsByteStream))
     |                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Cannot find path 'D:\ns_certs\LECRT-20230125-144135-aaa.domain.com\LECRT-20230125-144135-aaa.domain.com.pfx' because it does not exist.
Write-Error: Certificate completion failed. Exception Message: Exception calling "ToBase64String" with "1" argument(s): "Value cannot be null. (Parameter 'inArray')"

ADC - Cleanup
 -Cleanup type..............: Full
 -Cleanup...................: ** Completed
Write-Error: There were 1 errors during the request for CN: "aaa.domain.com"!

Finished with Errors! There were one or more errors, please check the log or rerun with the "-LogLevel Debug" option!