Monday, May 3, 2021

VMWare PowerShell Module Problems

 Problem

Can't update the PowerShell Modules for VMware. You did it a year of more ago because you use VMWare Powershell Modules offline on an airgapped system. You remember doing it, but can't recall the sequence of events. Typical.

Errors

Now you recall, you try to use the:
Install-Module -Name VMware.PowerCLI
But you get an error. And the Error dialog says, Do you want to load the new version of NuGet, and of course you say yes, cause, "do it for me" is easiest. But it doesn't work.
WARNING: Unable to download from URI 'https://go.microsoft.com/fwlink/?LinkID=627338&clcid=0x409' to ''.
WARNING: Unable to download the list of available providers. Check your internet connection.
PackageManagement\Install-PackageProvider : No match was found for the specified search criteria for the provider 'NuGet'. 
The package provider requires 'PackageManagement' and 'Provider' tags. Please check if the specified package has the tags.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:7405 char:21
+ ...     $null = PackageManagement\Install-PackageProvider -Name $script:N ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (Microsoft.Power...PackageProvider:InstallPackageProvider) [Install-PackageP 
   rovider], Exception
    + FullyQualifiedErrorId : NoMatchFoundForProvider,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackageProvider
 
PackageManagement\Import-PackageProvider : No match was found for the specified search criteria and provider name 'NuGet'. 
Try 'Get-PackageProvider -ListAvailable' to see if the provider exists on the system.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:7411 char:21
+ ...     $null = PackageManagement\Import-PackageProvider -Name $script:Nu ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (NuGet:String) [Import-PackageProvider], Exception
    + FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.ImportPackageProvider
You try an administrator shell if you didn't have that already, but still NO.
OK, now here is what the problem is. The last time you ran this, TLS1.0 and SSL3.0 were great!! but now they suck and you are still using them. What to prove it? type:
[Net.ServicePointManager]::SecurityProtocol
and you get tls, ssl3 and Pppptthhrrrr. You lose.

OK, so Lets add the new TLS 1.1 and 1.2

Set-ItemProperty -Path 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\.NetFramework\v4.0.30319' -Name 'SchUseStrongCrypto' -Value '1' -Type DWord
and then
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\.NetFramework\v4.0.30319' -Name 'SchUseStrongCrypto' -Value '1' -Type DWord
Now RESTART POWERSHELL IN ADMINISTRATOR MODE and now if you type:
[Net.ServicePointManager]::SecurityProtocol
You get tls, tsl1, tls12 - You'll be happy now. Go back and try your module update, import module, etc. and NuGet will load. 

No comments:

Post a Comment