Install PowerShell 5.0, Nuget and download cmdlets behind proxy
Install Windows Management Framework 5.0 (WMF)
Go to the Microsoft Download center, download Windows Management Framework 5.0 from this link and install it. The installation requires reboot of the PC. After the reboot open the PowerShell command shell window as administrator and verify the version of the installed PowerShell.$PSVersionTable.PSVersion
The output should be similar to what I have below:
Major Minor Build Revision
----- ----- ----- --------
5 0 10586 117
Set up proxy credentials
What I did to make it work for me is executing those two commands.$wc = New-Object System.Net.WebClient
$wc.Proxy.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials
It is clear from my previous statement that I am not sure what this does. Of course as a hardcore true ninja developer I just used my most advanced skill, Copy-Paste indeed. Here is the link to the source. If you truly want to understand what it does, you can visit this link or this link.
Install the Nuget package provider
Check if nuget is available in the package providers by running the following command.Get-PackageProvider -ListAvailable
Name Version DynamicOptions
---- ------- --------------
msi 3.0.0.0 AdditionalArguments
msu 3.0.0.0
PowerShellGet 1.0.0.1 PackageManagementProvider, Type, Scope, InstallUpdate, PackageManagementPr...
Programs 3.0.0.0 IncludeWindowsInstaller, IncludeSystemComponent
If the above output is your case and nuget is not presented, you have to install it.
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
Here is my successful installation output:
Name Version Source Summary
---- ------- ------ -------
nuget 2.8.5.208 https://oneget.org/nuget-2.... NuGet provider for the OneGet meta-pa...
Almost there, register the default repository for PowerShell modules
My attempt to install SharePointPnPPowerShellOnline failed again after the above steps so I had to also register default repository:Register-PSRepository -Name "PSGallery" –SourceLocation "https://www.powershellgallery.com/api/v2/" -InstallationPolicy Trusted
Finally, install the SharePointPnPPowerShellOnline module
RunInstall-Module SharePointPnPPowerShellOnline
Good to go! Have fun with the PnP-PowerShell cmdlets.
More PnP-PowerShell info on this link. P.S. If you experience error 'UnauthorizedAccess,Microsoft.PowerShell.Commands.ImportModuleCommand' when running the SharePointPnPPowerShellOnline module then you may need to change the PowerShell execution policy.Set-ExecutionPolicy RemoteSigned
Comments
Tony
| 29 Jan 2018
Hey Velin thanks for this! great tutorial
Richard
| 30 Aug 2018
This was a huge help thanks
Darius
| 30 Jan 2019
Hey Velin, great tutorial
Ilies
| 27 Mar 2019
Hello Velin, I tried your methode but I can't get Nuget i have a message error that i generated by verbose:
Cannot download link 'https://go.microsoft.com/fwlink/?LinkID=627338&clcid=0x409'
Do you have a solution for me ?
ps: it's in work proxy
Dawns
| 10 Apr 2020
Hi, it's real help full thanks,
if also we have issue to donwload try in "Admin Powershell : [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12"
Thanks again Velin
Nigel Sheridan-Smith
| 23 Sep 2020
DOn't forget this for TLS 1.2
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12