Skip to content
SharePoint PnP PowerShell CmdLets
C# PowerShell
Branch: master
Clone or download

Latest commit

Latest commit 3f994e7 Mar 10, 2020

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github typ: Double word "that" Feb 26, 2019
Binaries Updated modernization binaries for the March 2020 release Mar 10, 2020
Commands March 2020 Release Mar 9, 2020
Documentation Project cleanup Feb 23, 2018
HelpAttributes Enriched functionality, cleaned up code, resolved few issues Jan 10, 2020
ModuleFilesGenerator Code cleanup. Removing commented out code and non used variable to re… Jan 21, 2020
Resources Updated files per review request(S). Updated test case to include tes… Jan 27, 2017
Samples Update Install-PowerShellPackageMangement.ps1 Sep 11, 2019
SharePointPnP.PowerShell.Core Implemented .NET Standard 2.0 / Cross-Platform support Feb 15, 2018
Tests Merge branch 'dev' of https://github.com/SharePoint/PnP-PowerShell in… Dec 22, 2019
.gitattributes Implemented .NET Standard 2.0 / Cross-Platform support Feb 15, 2018
.gitignore Removed documents from gitignore Jan 4, 2018
CHANGELOG.md merged conflict Mar 9, 2020
CONTRIBUTING.md typo: behaviour -> behavior Feb 26, 2019
Install.ps1 Updated precompiler variables May 9, 2016
LICENSE Update LICENSE Feb 6, 2017
PnPPowerShell.sln Renamed project Feb 25, 2018
PostBuild.ps1 updated postbuild Feb 8, 2019
README.md Merge branch 'dev' into main-readme Jan 9, 2020
SharePointPnP.PowerShell.sln Added initial support for SP2019 Feb 6, 2019
version.txt March 2020 Release Mar 9, 2020

README.md

SharePointPnP.PowerShell Commands

Summary

This solution contains a library of PowerShell commands that allows you to perform complex provisioning and artifact management actions towards SharePoint. The commands use a combination of CSOM and REST behind the scenes, and can work against both SharePoint Online as SharePoint On-Premises.

SharePoint Patterns and Practices

Applies to

  • Sharepoint Online (Multi Tenant & Dedicated)
  • SharePoint 2019 on-premises
  • SharePoint 2016 on-premises
  • SharePoint 2013 on-premises

Prerequisites

In order to generate the Cmdlet help you need to have the Windows Management Framework v4.0 installed, which you can download from http://www.microsoft.com/en-us/download/details.aspx?id=40855

If it is not pre-installed on your operating system, you can find installation instructions in the WMF release notes. Check out the "Getting Started" section to make sure you have all requirements in place.

Latest Release Quick Download

The latest release can be found on this link


Commands included

Navigate here for an overview of all cmdlets and their parameters

Installation

There are two ways:

1. Using the PowerShell Gallery (Recommended)

If you main OS is Windows 10, or if you have PowerShellGet installed, you can run the following commands to install the PowerShell cmdlets:

SharePoint Version Command to install
SharePoint Online Install-Module SharePointPnPPowerShellOnline
SharePoint 2019 Install-Module SharePointPnPPowerShell2019
SharePoint 2016 Install-Module SharePointPnPPowerShell2016
SharePoint 2013 Install-Module SharePointPnPPowerShell2013

Notice: if you install the latest PowerShellGet from Github, you might receive an error message stating

PackageManagement\Install-Package : The version 'x.x.x.x' of the module 'SharePointPnPPowerShellOnline' being installed is not catalog signed.

In order to install the cmdlets when you get this error specify the -SkipPublisherCheck switch with the Install-Module cmdlet, e.g. Install-Module SharePointPnPPowerShellOnline -SkipPublisherCheck -AllowClobber

2. Downloading the Files directly

You can download the setup files from the releases section of the PnP PowerShell repository. These files will up be updated on a monthly basis. Run the install and restart any open instances of PowerShell to use the cmdlets.

How to Update the Cmdlets

Every month a new release will be made available of the PnP PowerShell Cmdlets. If you earlier installed the cmdlets using the setup file, simply download the latest version and run the setup. This will update your existing installation.

If you have installed the cmdlets using PowerShellGet with Install-Module from the PowerShell Gallery then you will be able to use the following command to install the latest updated version:

Update-Module SharePointPnPPowerShell*

This will automatically load the module after starting PowerShell 3.0.

You can check the installed PnP-PowerShell versions with the following command:

Get-Module SharePointPnPPowerShell* -ListAvailable | Select-Object Name,Version | Sort-Object Version -Descending

Getting started

To use the library you first need to connect to your tenant:

Connect-PnPOnline –Url https://yoursite.sharepoint.com –Credentials (Get-Credential)

Or if you have Multi Factor Authentication enabled or if you are using a federated identity provider like AD FS, instead use:

Connect-PnPOnline –Url https://yoursite.sharepoint.com –UseWebLogin

To view all cmdlets, enter:

Get-Command -Module SharePointPnPPowerShell*

At the following links you will find a few videos on how to get started with the cmdlets:

Setting up credentials

See this wiki page for more information on how to use the Windows Credential Manager to setup credentials that you can use in unattended scripts.

Contributing

If you want to contribute to this SharePoint Patterns and Practices PowerShell library, please proceed here

Solution/Authors

Solution Author(s)
SharePointPnP.PowerShell Erwin van Hunen and countless community contributors

Disclaimer

THIS CODE IS PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.

Building the source code

If you have set up the projects and you are ready to build the source code, make sure to build the SharePointPnP.PowerShellModuleFilesGenerator project first. This project will be executed after every build and it will generate the required PSD1 and XML files with cmdlet documentation in them.

When you build the solution a postbuild script will copy the required files to a folder in your users folder called C:\Users\<YourUserName>\Documents\WindowsPowerShell\Modules\SharePointPnPPowerShell<Platform>. During build also the help and document files will be generated. If you have a session of PowerShell open in which you have used the PnP Cmdlets, make sure to close this PowerShell session first before you build. You will receive a build error otherwise because it tries to overwrite files that are in use.

To debug the cmdlets: launch PowerShell and attach Visual Studio to the powershell.exe process. In case you want to debug methods in PnP Sites Core, make sure that you open the PnP Sites Core project instead, and then attach Visual Studio to the powershell.exe. In case you see strange debug behavior, like it wants to debug PSReadLine.ps1, uninstall the PowerShell extension from Visual Studio.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

You can’t perform that action at this time.