I had to prepare corporate Windows 7 PC behind proxy to be able to work with the SharePointPnPPowerShellOnline cmdlets. Here are the steps that I performed to get there. Windows administrator account will be needed.
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.
The output should be similar to what I have below:
Major Minor Build Revision ----- ----- ----- -------- 5 0 10586 117
Set up proxy credentialsWhat I did to make it work for me is executing those two commands.
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.
$wc = New-Object System.Net.WebClient $wc.Proxy.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials
Install the Nuget package providerCheck if nuget is available in the package providers by running the following command.
If the above output is your case and nuget is not presented, you have to install it.
Name Version DynamicOptions ---- ------- -------------- msi 22.214.171.124 AdditionalArguments msu 126.96.36.199 PowerShellGet 188.8.131.52 PackageManagementProvider, Type, Scope, InstallUpdate, PackageManagementPr... Programs 184.108.40.206 IncludeWindowsInstaller, IncludeSystemComponent
Here is my successful installation output:
Install-PackageProvider -Name NuGet -MinimumVersion 220.127.116.11 -Force
Name Version Source Summary ---- ------- ------ ------- nuget 18.104.22.168 https://oneget.org/nuget-2.... NuGet provider for the OneGet meta-pa...
Almost there, register the default repository for PowerShell modulesMy 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 moduleRun
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.