Back in April of 2020, Microsoft updated the security used in the PowerShell Gallery. Weird errors started popping up. Errors that didn’t really point to a security problem. It looked like modules in the gallery weren’t there anymore. Errors like this:

WARNING: Unable to resolve package source ''.
No match was found for the specified search criteria and module name 'dbatools'. Try Get-PSRepository to see all available registered module repositories.
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power...ets.FindPackage:FindPackage) [Find-Package], Exception
    + FullyQualifiedErrorId : NoMatchFoundForCriteria, Microsoft.PowerShell.PackageManagement.Cmdlets.FindPackage

Fortunately the fix was easy…once you knew what it was. Add this

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
to your profile. If you are using Invoke-Command on a remote computer to access the gallery or something else using TLS, add it to the beginning of your scriptblock.

Thanks for reading.