Powershell: PowerNSX: Refusing to load module.


Summary:
"The PowerShell Core Beta has known issues that cause PowerNSX to fail.  Refusing to load module."
Basically, this happens when you upgrade powershell to 6.1.x.  It's related to a bad section of code in the module that checks for beta releases that should probably deprecated or taken out.

Workaround:
Modify line 82 to read as such:
if ( ( $script:PNsxPSTarget -eq "Core" ) -and ( $PSVersionTable.GitCommitId -notmatch '^v6.[\d].[\d]+$|6.[\d].[\d]+$') ) {

Or

Comment out line 82 through 90 to remove the check entirely.

Details:
The check appears to happen because the GitCommitId format may have changed from 6.0 to 6.1 where it was prepended with a v in 6.0 whereas in 6.1 it is not longer prepended.

Links:
https://github.com/vmware/powernsx/issues/557

No comments: