dell / iDRAC-Redfish-Scripting

Python and PowerShell scripting for Dell EMC PowerEdge iDRAC REST API with DMTF Redfish
GNU General Public License v2.0
606 stars 279 forks source link

PowerShell 7 - CompileAssemblyFromSource #101

Closed jahedges-tp closed 4 years ago

jahedges-tp commented 4 years ago

I'd like to switch some automations over to PowerShell 7 for easy -parallel jobs.

However, when I run Set-UpdateOneDeviceREDFISH.psm1, PowerShell 7 doesn't like that CompileAssemblyFromSource.

Line | 92 | $TAResults=$Provider.CompileAssemblyFromSource($Params,$TASou … | ~~~~~~~~~~~~~ | Exception calling "CompileAssemblyFromSource" with "2" argument(s): "Operation is not supported on | this platform."

InvalidOperation: C:\Users\jake.hedges\Projects\Add-HPC\Set-UpdateOneDeviceREDFISH.psm1:95 Line | 95 | $TrustAll = $TAAssembly.CreateInstance("Local.ToolkitExtensio … | ~~~~~~~~~~~~~ | You cannot call a method on a null-valued expression.

InvalidOperation: C:\Users\jake.hedges\Projects\Add-HPC\Set-UpdateOneDeviceREDFISH.psm1:96 Line | 96 | [System.Net.ServicePointManager]::CertificatePolicy = $TrustA … | ~~~~~~~~~~~~~ | The property 'CertificatePolicy' cannot be found on this object. Verify that the property exists and | can be set.

Is there any way we can easily alter this? I have tried to simply comment out Ignore-SSLCertificate, but then script falsely returns that this idrac does not support it.

Finally, thank you for the excellent collection. Many scripts have been extremely useful to us, and this does function fine on PowerShell 5, but since we configure many idracs, id like to do some of these in parallel to speed things up.

texroemer commented 4 years ago

Hi @jahedges-tp

Powershell 6/7 has changed behavior for SSL cert validation. They now added "-SkipCertificateCheck" option to Invoke-WebRequest which will solve the error you hit.

Powershell 6/7 also changed behavior on how to read / parse the firmware update package for POST request so will need to also fix this issue in the cmdlet. Working on both issues now and hopefully have the updated cmdlet uploaded soon.

Thanks

texroemer commented 4 years ago

Hi @jahedges-tp

All cmdlets have been updated now to support Powershell 7.

Thanks

jahedges-tp commented 4 years ago

Incredible! Thank you Texas, and I'll begin testing over the next couple weeks. Your earlier commented prompted me to do quite a bit of PowerShell study, so I am hoping that I can assist if there are any issues now. Ty again.