Chances are you're getting this error:
unable to resolve package source 'https://www.powershellgallery.com/api/v2/'
Turns out it isn't allowed through your proxy server, run this in your PowerShell session and try again:
$webclient=New-Object System.Net.WebClient $webclient.Proxy.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials
[Net.ServicePointManager]::SecurityProtocol = "tls12"
Now every command you run is sent and allowed through the proxy.
Thank you! This worked for me, even when providing the proxy & credentials wouldn't work.
ReplyDeleteOMG you deserve a cookie!!!
ReplyDeletebeen busting my head with this for a week.....
Nice one! Saved me a lot of time and hassle thank you for this! :)
ReplyDeleteThanks !
ReplyDeletethank you man...works like a charm
ReplyDeleteNice one, thanks
ReplyDeleteThis worked for me, Thanks
ReplyDeletethanks !!!
ReplyDeleteYou are simply awesome!! Thank you so much!!
ReplyDeleteAwesome, this worked after a lot of research and wrong paths.
ReplyDeleteThank you.
Ovi
Is there a way to make this permanent as soon as powershell runs?
ReplyDeleteadd it to your $PROFILE
DeleteThank you!
ReplyDeleteThank you. Gold Star effort
ReplyDeleteHero!
ReplyDeletethanks, this worked and is still applicable in 2020! :)
ReplyDeleteSorry to spoil the party, but this dont work for me. :-(
ReplyDeletePS H:\> $webclient=New-Object System.Net.WebClient
PS H:\> $webclient.Proxy.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials
PS H:\> Find-Module -Name PowerShellGet
WARNING: Unable to resolve package source 'https://www.powershellgallery.com/api/v2'.
PackageManagement\Find-Package : No match was found for the specified search criteria and module name 'PowerShellGet'.
Dont have any more hair on my head to rip off!! Cant find the problem.
This is a TLS problem. Enter this in your PowerShell:
Delete[Net.ServicePointManager]::SecurityProtocol = "tls12"
Then run the command.
THANK YOU !!!
DeleteCan I upvote this 1000 times???
DeleteThank you Anonymous!!!
you are owsome! thanks a lot!
Deleteomg, thanks, I could blow you right now!
DeleteWoot! Thank you.
DeleteIt didn't work for me either
ReplyDeleteThis is a TLS problem. Enter this in your PowerShell:
ReplyDelete[Net.ServicePointManager]::SecurityProtocol = "tls12"
Then run the command.
Thanks, you saved my time
DeleteNo this doesn't seem to work anymore. If you're installing or updating you have to download the msi file and do it manually. To update be sure to remove the previous version first. Par for the course that Msft doesn't take into account most of their customers are behind proxies and actually provide some guidance on this.
ReplyDeleteThis is an issue with PowerShell 5.1.. If you get version 6 or 7 from https://github.com/PowerShell/PowerShell/releases/tag/v7.0.0, or https://github.com/PowerShell/PowerShell/releases/tag/v6.2.3 everything works.
Deletethis works for me. Thanks a lot.
ReplyDeleteThis worked for me as well, tested on two Windows 2016 servers.
ReplyDeletePSVersion 5.1.14409.1018
ReplyDeletePSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
It's work! Thank you a lot !!!
PSVersion 5.1.17134.858
ReplyDeletePSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
It works, Thank you so much.
Thank you sir!
ReplyDeleteYou saved my day, thanks
ReplyDeleteStill works perfectly in 2020!
ReplyDeleteIt works awesome. Thank you so much. .
ReplyDeleteHello Guys... request help this doesn't work for me on window server 2016 datacenter
ReplyDeletePS C:\Windows\system32> $webclient=New-Object System.Net.WebClient
PS C:\Windows\system32> $webclient.Proxy.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials
PS C:\Windows\system32> Find-Module -Name PowerShellGet
WARNING: Unable to resolve package source 'https://www.powershellgallery.com/api/v2'.
PackageManagement\Find-Package : No match was found for the specified search criteria and module name 'PowerShellGet'.
Try Get-PSRepository to see all available registered module repositories.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.2.3\PSModule.psm1:8873 char:9
+ PackageManagement\Find-Package @PSBoundParameters | Microsoft ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Microsoft.Power...ets.FindPackage:FindPackage) [Find-Package], Exceptio
n
+ FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.FindPackage
PS C:\Windows\system32> [Net.ServicePointManager]::SecurityProtocol = "tls12"
PS C:\Windows\system32> Find-Module -Name PowerShellGet
WARNING: Unable to resolve package source 'https://www.powershellgallery.com/api/v2'.
PackageManagement\Find-Package : No match was found for the specified search criteria and module name 'PowerShellGet'.
Try Get-PSRepository to see all available registered module repositories.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.2.3\PSModule.psm1:8873 char:9
+ PackageManagement\Find-Package @PSBoundParameters | Microsoft ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Microsoft.Power...ets.FindPackage:FindPackage) [Find-Package], Exceptio
n
+ FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.FindPackage
Worked for me, thx!
ReplyDeleteThank you so much
ReplyDeleteIts resolved my issue. Thank you so much.
ReplyDeleteI only had to change to TLS1.2 to get it to resolve: [Net.ServicePointManager]::SecurityProtocol = "tls12"
ReplyDelete