I have to admit – executing the same command three times and expecting different results is dumb, but I still do it anyway. Fortunately, after trying three times I usually resort to other methods and try to solve the problem I have. Today while trying to trust PowerShellGallery I was greeted with an error.
The error is cryptic – Invalid Class for a Test-Connection during Set-PSRepository trusted installation policy. That's not good, and not really an error that is obvious. Fortunately, I read the whole error and noticed one little thing. The error was coming from PowerShellGet 1.0.0.1 version. One thing to know about PowerShellGet is that it comes bundled in on newer systems or when you install PowerShell 5.1. And just like Pester it's heavily outdated at the start.