-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Connect-Rubrik fails when using PowerShell version lower than 6 #817
Comments
A quick search indicates that both Invoke-RubrikGraphQLCall.ps1 and Start-RubrikDownload.ps1 also use the SkipCertificateCheck parameter of the Invoke-RestMethod cmdlet, but in these cases a check on the available PowerShell version is correctly performed (using Test-PowerShellSix). |
@guirava, we found an issue in the code that was added in Connect-Rubrik for AccountId and Secret. After debugging the code in Connect-Rubrik, I found that the "SkipCertificateCheck" attribute in the code below is not compatible with PS 5.1.x. Would it be possible to wrap the $RestSplat with an if statement where we use Test-PowerShellSix again and not include the SkipCertificateCheck attribute when the PS version is not 6 and higher? I have tested this and it does in fact fix the issue for those of us still running PS 5.1.x. Line 150 in Connect-Rubrik - Version 6.0.1 Please let me know if this is not clear. |
I would really like this to be implemented since it would be a hassle to upgrade all powershells to higher version than 5.1 that is the standard on all Windows systems. |
It would be great if support for the "default" powershell version was added. Upgrading to version 7 turns out to be not as easy as I thought, especially if another system runs some scripts to monitor the results and uses the "old" Powershell version by default. |
I have the same issue. Please add handling for PS5 wherever irm is used. To work around this, I have commented out the line in the splat so that the command will run in PS5. (this is Connect-Rubrik)
Of course this might break something else, but for my needs it works fine. If I had to PR it, I would do this:
... But you have your own custom function for handling PS6+ which has this flaw in its implementation. |
PR submitted, but please enjoy your weekend first! |
Current Behavior:
When using Connect-Rubrik to connect to a Rubrik cluster, using a Rubrik Service Account (new functionality in Rubrik PowerShell module version 6.0.1), the connection fails to be established if an "old" PowerShell version is used. Connect-Rubrik.ps1 uses the SkipCertificateCheck parameter of the Invoke-RestMethod cmdlet. The SkipCertificateCheck was introduced in PowerShell version 6, and is not available in older PowerShell versions, causing failure in connection establishment.
Expected Behavior:
The Connect-Rubrik should probe the available PowerShell version (using Test-PowerShellSix?), and the the SkipCertificateCheck parameter of the Invoke-RestMethod cmdlet should only be used if PowerShell version 6 or higher is available. The SkipCertificateCheck functionality may be emulated in another way, should PowerShell version 6 or higher not be available.
Steps to Reproduce:
Connect to a Rubrik cluster, using the Connect-Rubrik cmdlet, using a Rubrik Service Account, using a PowerShell version below 6.
Context:
Get-Module -ListAvailable Rubrik
$PSVersiontable.PSVersion
$PSVersiontable.PSVersion
on PowerShell 6 and later, use(Get-WMIObject win32_operatingsystem).Name
for Windows PowerShellFailure Logs
Please include any relevant log snippets or files here, IMPORTANT all information will be visible publicly on GitHub. Do not include computer or user names, passwords, API tokens or any identifiable information when submitting failure logs.
The text was updated successfully, but these errors were encountered: