Table of contents
Collapse the table of content
Expand the table of content

PnP PowerShell overview

Bert Jansen|Last Updated: 2/16/2017

SharePoint Patterns and Practices (PnP) contains a library of PowerShell commands (PnP PowerShell) that allows you to perform complex provisioning and artifact management actions towards SharePoint. The commands use CSOM and can work against both SharePoint Online as SharePoint On-Premises.

SharePoint Patterns and Practices

Applies to: SharePoint Online | SharePoint 2016 | SharePoint 2013


Setup files

You can download setup files from These files will up be updated on a monthly basis.

Using the Windows Management Framework

If you main OS is Windows 10, you can run the following commands to install the PowerShell cmdlets:

SharePoint Online

Install-Module SharePointPnPPowerShellOnline -AllowClobber

SharePoint 2016

Install-Module SharePointPnPPowerShell2016 -AllowClobber

SharePoint 2013

Install-Module SharePointPnPPowerShell2013 -AllowClobber

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

PackageManagement\Install-Package : The version '2.8.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

Alternatively for installation on machines that have at least PowerShell v3 installed (you can find this out by opening PowerShell and running $PSVersionTable.PSVersion. The value for Major should be above 3) you can run the below command which will install PowerShell Package Management and then install the PowerShell Modules from the PowerShell Gallery

Invoke-Expression (New-Object Net.WebClient).DownloadString('')

If you wish to see the commands that the above will run please see the files as stored in the below locations:

Once the above has been completed you can then start to use the PowerShell Modules

Once new releases of the module are made available on the PowerShell Gallery you will be able to use the 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


A build script will copy the required files to a folder in your users folder, called: C:\Users\<YourUserName>\Documents\WindowsPowerShell\Modules\SharePointPnPPowerShell<Platform>


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

Connect-PnPOnline –Url –Credentials (Get-Credential)

To view all cmdlets, enter

Get-Command -Module *PnP*

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


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

Cmdlet overview


Get‑PnPAppInstanceReturns a SharePoint AddIn Instance in the site
Uninstall‑PnPAppInstanceRemoves an app from a site
Import‑PnPAppPackageAdds a SharePoint Addin to a site

Base Cmdlets

Get‑PnPAuthenticationRealmGets the authentication realm for the current web
Get‑PnPAzureADManifestKeyCredentialsCreates the JSON snippet that is required for the manifest JSON file for Azure WebApplication / WebAPI apps
Get‑PnPContextReturns a Client Side Object Model context
Set‑PnPContextSets the Client Context to use by the cmdlets
Get‑PnPHealthScoreRetrieves the current health score value of the server
Connect‑PnPOnlineConnects to a SharePoint site and creates a context that is required for the other PnP Cmdlets
Disconnect‑PnPOnlineDisconnects the context
Get‑PnPPropertyWill populate properties of an object and optionally, if needed, load the value from the server. If one property is specified its value will be returned to the output.
Execute‑PnPQueryExecutes any queued actions / changes on the SharePoint Client Side Object Model Context
Get‑PnPStoredCredentialReturns a stored credential from the Windows Credential Manager
Set‑PnPTraceLogDefines if tracing should be turned on. PnP Core, which is the foundation of these cmdlets uses the standard Trace functionality of .NET. With this cmdlet you can turn capturing of this trace to a log file on or off.


Add‑PnPCustomActionAdds a custom action to a web
Get‑PnPCustomActionReturns all or a specific custom action(s)
Remove‑PnPCustomActionRemoves a custom action
Get‑PnPHomePageReturns the URL to the home page
Set‑PnPHomePageSets the home page of the current web.
Add‑PnPJavaScriptBlockAdds a link to a JavaScript snippet/block to a web or site collection
Add‑PnPJavaScriptLinkAdds a link to a JavaScript file to a web or sitecollection
Get‑PnPJavaScriptLinkReturns all or a specific custom action(s) with location type ScriptLink
Remove‑PnPJavaScriptLinkRemoves a JavaScript link or block from a web or sitecollection
Get‑PnPMasterPageReturns the URLs of the default Master Page and the custom Master Page.
Set‑PnPMasterPageSets the default master page of the current web.
Set‑PnPMinimalDownloadStrategyActivates or deactivates the minimal downloading strategy.
Add‑PnPNavigationNodeAdds a menu item to either the quicklaunch or top navigation
Remove‑PnPNavigationNodeRemoves a menu item from either the quicklaunch or top navigation
Disable‑PnPResponsiveUIDisables the PnP Responsive UI implementation on a classic SharePoint Site
Enable‑PnPResponsiveUIEnables the PnP Responsive UI implementation on a classic SharePoint Site
Get‑PnPThemeReturns the current theme/composed look of the current web.
Set‑PnPThemeSets the theme of the current web.

Content Types

Add‑PnPContentTypeAdds a new content type
Get‑PnPContentTypeRetrieves a content type
Remove‑PnPContentTypeRemoves a content type from a web
Remove‑PnPContentTypeFromListRemoves a content type from a list
Get‑PnPContentTypePublishingHubUrlReturns the url to Content Type Publishing Hub
Add‑PnPContentTypeToListAdds a new content type to a list
Set‑PnPDefaultContentTypeToListSets the default content type for a list
Remove‑PnPFieldFromContentTypeRemoves a site column from a content type
Add‑PnPFieldToContentTypeAdds an existing site column to a content type

Document Sets

Remove‑PnPContentTypeFromDocumentSetRemoves a content type from a document set
Add‑PnPContentTypeToDocumentSetAdds a content type to a document set
Add‑PnPDocumentSetCreates a new document set in a library.
Set‑PnPDocumentSetFieldSets a site column from the available content types to a document set
Get‑PnPDocumentSetTemplateRetrieves a document set template

Event Receivers

Add‑PnPEventReceiverAdds a new event receiver
Get‑PnPEventReceiverReturns all or a specific event receiver
Remove‑PnPEventReceiverRemoves/unregisters a specific event receiver


New‑PnPExtensbilityHandlerObjectCreates an ExtensibilityHandler Object, to be used by the Get-SPOProvisioningTemplate cmdlet
Disable‑PnPFeatureDisables a feature
Enable‑PnPFeatureEnables a feature
Get‑PnPFeatureReturns all activated or a specific activated feature


Add‑PnPFieldAdds a field to a list or as a site column
Get‑PnPFieldReturns a field from a list or site
Remove‑PnPFieldRemoves a field from a list or a site
Add‑PnPFieldFromXmlAdds a field to a list or as a site column based upon a CAML/XML field definition
Add‑PnPTaxonomyFieldAdds a taxonomy field to a list or as a site column.

Files and Folders

Add‑PnPFileUploads a file to Web
Copy‑PnPFileCopies a file or folder to a different location
Find‑PnPFileFinds a file in the virtual file system of the web.
Get‑PnPFileDownloads a file.
Move‑PnPFileMoves a file to a different location
Remove‑PnPFileRemoves a file.
Rename‑PnPFileRenames a file in its current location
Set‑PnPFileCheckedInChecks in a file
Set‑PnPFileCheckedOutChecks out a file
Add‑PnPFolderCreates a folder within a parent folder
Ensure‑PnPFolderReturns a folder from a given site relative path, and will create it if it does not exist.
Get‑PnPFolderReturn a folder object
Move‑PnPFolderMove a folder to another location in the current web
Remove‑PnPFolderDeletes a folder within a parent folder
Rename‑PnPFolderRenames a folder
Get‑PnPFolderItemList content in folder

Information Management

Get‑PnPSiteClosureGet the site closure status of the site which has a site policy applied
Set‑PnPSiteClosureOpens or closes a site which has a site policy applied
Set‑PnPSitePolicySets a site policy
Get‑PnPSitePolicyRetrieves all or a specific site policy


Set‑PnPDefaultColumnValuesSets default column values for a document library
Get‑PnPListReturns a List object
New‑PnPListCreates a new list
Remove‑PnPListDeletes a list
Set‑PnPListUpdates list settings
Add‑PnPListItemAdds an item to a list
Get‑PnPListItemRetrieves list items
Remove‑PnPListItemDeletes an item from a list
Set‑PnPListItemUpdates a list item
Set‑PnPListPermissionSets list permissions
Get‑PnPProvisioningTemplateFromGalleryRetrieves or searches provisioning templates from the PnP Template Gallery
Request‑PnPReIndexListMarks the list for full indexing during the next incremental crawl
Add‑PnPViewAdds a view to a list
Get‑PnPViewReturns one or all views from a list
Remove‑PnPViewDeletes a view from a list

Microsoft Graph

Connect‑PnPMicrosoftGraphUses the Microsoft Authentication Library (Preview) to connect to Azure AD and to get an OAuth 2.0 Access Token to consume the Microsoft Graph API
Get‑PnPUnifiedGroupGets one Office 365 Group (aka Unified Group) or a list of Office 365 Groups
New‑PnPUnifiedGroupCreates a new Office 365 Group (aka Unified Group)
Remove‑PnPUnifiedGroupRemoves one Office 365 Group (aka Unified Group) or a list of Office 365 Groups
Set‑PnPUnifiedGroupSets Office 365 Group (aka Unified Group) properties


Add‑PnPDataRowsToProvisioningTemplateAdds datarows to a list inside a PnP Provisioning Template
Remove‑PnPFileFromProvisioningTemplateRemoves a file from a PnP Provisioning Template
Add‑PnPFileToProvisioningTemplateAdds a file to a PnP Provisioning Template
Convert‑PnPFolderToProvisioningTemplateCreates a pnp package file of an existing template xml, and includes all files in the current folder
Add‑PnPListFoldersToProvisioningTemplateAdds folders to a list in a PnP Provisioning Template
Apply‑PnPProvisioningTemplateApplies a provisioning template to a web
Convert‑PnPProvisioningTemplateConverts a provisioning template to an other schema version
Get‑PnPProvisioningTemplateGenerates a provisioning template from a web
Load‑PnPProvisioningTemplateLoads a PnP file from the file systems
New‑PnPProvisioningTemplateCreates a new provisioning template object
Save‑PnPProvisioningTemplateSaves a PnP file to the file systems
New‑PnPProvisioningTemplateFromFolderGenerates a provisioning template from a given folder, including only files that are present in that folder
Set‑PnPProvisioningTemplateMetadataSets metadata of a provisioning template


Set‑PnPAvailablePageLayoutsSets the available page layouts for the current site
Set‑PnPDefaultPageLayoutSets a specific page layout to be the default page layout for a publishing site
Add‑PnPHtmlPublishingPageLayoutAdds a HTML based publishing page layout
Add‑PnPMasterPageAdds a Masterpage
Add‑PnPPublishingImageRenditionAdds an Image Rendition if the Name of the Image Rendition does not already exist. This prevents creating two Image Renditions that share the same name.
Get‑PnPPublishingImageRenditionReturns all image renditions or if Identity is specified a specific one
Remove‑PnPPublishingImageRenditionRemoves an existing image rendition
Add‑PnPPublishingPageAdds a publishing page
Add‑PnPPublishingPageLayoutAdds a publishing page layout
Add‑PnPWikiPageAdds a wiki page
Remove‑PnPWikiPageRemoves a wiki page
Get‑PnPWikiPageContentGets the contents/source of a wiki page
Set‑PnPWikiPageContentSets the contents of a wikipage
Get‑PnPSearchConfigurationReturns the search configuration
Set‑PnPSearchConfigurationSets the search configuration
Submit‑PnPSearchQueryExecutes an arbitrary search query against the SharePoint search index
Get‑PnPSiteSearchQueryResultsExecutes a search query to retrieve indexed site collections

SharePoint Recycle Bin

Clear‑PnpRecycleBinItemPermanently deletes all or a specific recycle bin item
Move‑PnpRecycleBinItemMoves all items or a specific item in the first stage recycle bin of the current site collection to the second stage recycle bin
Restore‑PnpRecycleBinItemRestores the provided recycle bin item to its original location
Get‑PnPRecycleBinItemReturns the items in the recycle bin from the context
Get‑PnPTenantRecycleBinItemReturns the items in the tenant scoped recycle bin


Set‑PnPAppSideLoadingEnables the App SideLoading Feature on a site
Get‑PnPAuditingGet the Auditing setting of a site
Set‑PnPAuditingSet Auditing setting for a site
Get‑PnPSiteReturns the current site collection from the context.
Install‑PnPSolutionInstalls a sandboxed solution to a site collection. WARNING! This method can delete your composed look gallery due to the method used to activate the solution. We recommend you to only to use this cmdlet if you are okay with that.
Uninstall‑PnPSolutionUninstalls a sandboxed solution from a site collection


Get‑PnPSiteCollectionTermStoreReturns the site collection term store
Export‑PnPTaxonomyExports a taxonomy to either the output or to a file.
Import‑PnPTaxonomyImports a taxonomy from either a string array or a file
Set‑PnPTaxonomyFieldValueSets a taxonomy term value in a listitem field
Get‑PnPTaxonomyItemReturns a taxonomy item
Remove‑PnPTaxonomyItemRemoves a taxonomy item
Get‑PnPTaxonomySessionReturns a taxonomy session
Get‑PnPTermReturns a taxonomy term
New‑PnPTermCreates a taxonomy term
Get‑PnPTermGroupReturns a taxonomy term group
New‑PnPTermGroupCreates a taxonomy term group
Remove‑PnPTermGroupRemoves a taxonomy term group and all its containing termsets
Import‑PnPTermGroupFromXmlImports a taxonomy TermGroup from either the input or from an XML file.
Export‑PnPTermGroupToXmlExports a taxonomy TermGroup to either the output or to an XML file.
Get‑PnPTermSetReturns a taxonomy term set
Import‑PnPTermSetImports a taxonomy term set from a file in the standard format.
New‑PnPTermSetCreates a taxonomy term set

Tenant Administration

Get‑PnPAccessTokenGets the OAuth 2.0 Access Token to consume the Microsoft Graph API
Clear‑PnPTenantRecycleBinItemPermanently deletes a site collection from the tenant scoped recycle bin
Restore‑PnPTenantRecycleBinItemRestores a site collection from the tenant scoped recycle bin
Get‑PnPTenantSiteOffice365 only: Uses the tenant API to retrieve site information.
New‑PnPTenantSiteCreates a new site collection for the current tenant
Remove‑PnPTenantSiteOffice365 only: Removes a site collection from the current tenant
Set‑PnPTenantSiteOffice365 only: Uses the tenant API to set site information.
Get‑PnPTimeZoneIdReturns a time zone ID
Get‑PnPWebTemplatesOffice365 only: Returns the available web templates.

User and group management

Get‑PnPGroupReturns a specific group or all groups.
New‑PnPGroupAdds group to the Site Groups List and returns a group object
Remove‑PnPGroupRemoves a group from a web.
Set‑PnPGroupUpdates a group
Get‑PnPGroupPermissionsReturns the permissions for a specific SharePoint group
Set‑PnPGroupPermissionsAdds and/or removes permissions of a specific SharePoint group
New‑PnPUserAdds a user to the built-in Site User Info List and returns a user object
Remove‑PnPUserFromGroupRemoves a user from a group
Add‑PnPUserToGroupAdds a user to a group

User Profiles

New‑PnPPersonalSiteOffice365 only: Creates a personal / OneDrive For Business site
Get‑PnPUserProfilePropertyYou must connect to the tenant admin website ( with Connect-PnPOnline in order to use this cmdlet.
Set‑PnPUserProfilePropertyOffice365 only: Uses the tenant API to retrieve site information. You must connect to the tenant admin website ( with Connect-PnPOnline in order to use this command.


Send‑PnPMailSends an email using the Office 365 SMTP Service or SharePoint, depending on the parameters specified. See detailed help for more information.

Web Parts

Get‑PnPWebPartReturns a webpart definition object
Remove‑PnPWebPartRemoves a webpart from a page
Get‑PnPWebPartPropertyReturns a web part property
Set‑PnPWebPartPropertySets a web part property
Add‑PnPWebPartToWebPartPageAdds a webpart to a web part page in a specified zone
Add‑PnPWebPartToWikiPageAdds a webpart to a wiki page in a specified table row and column
Get‑PnPWebPartXmlReturns the webpart XML of a webpart registered on a site


Set‑PnPIndexedPropertiesMarks values of the propertybag to be indexed by search. Notice that this will overwrite the existing flags, i.e. only the properties you define with the cmdlet will be indexed.
Add‑PnPIndexedPropertyMarks the value of the propertybag key specified to be indexed by search.
Remove‑PnPIndexedPropertyRemoves a key from propertybag to be indexed by search. The key and it's value remain in the propertybag, however it will not be indexed anymore.
Get‑PnPIndexedPropertyKeysReturns the keys of the property bag values that have been marked for indexing by search
Get‑PnPPropertyBagReturns the property bag values.
Remove‑PnPPropertyBagValueRemoves a value from the property bag
Set‑PnPPropertyBagValueSets a property bag value
Request‑PnPReIndexWebMarks the web for full indexing during the next incremental crawl
Get‑PnPRequestAccessEmailsReturns the request access e-mail addresses
Set‑PnPRequestAccessEmailsSets Request Access Emails on a web
Get‑PnPSubWebsReturns the subwebs of the current web
Get‑PnPWebReturns the current web object
New‑PnPWebCreates a new subweb under the current web
Remove‑PnPWebRemoves a subweb in the current web
Set‑PnPWebSets properties on a web
Invoke‑PnPWebActionExecutes operations on web, lists and list items.


Add‑PnPWorkflowDefinitionAdds a workflow definition
Get‑PnPWorkflowDefinitionReturns a workflow definition
Remove‑PnPWorkflowDefinitionRemoves a workflow definition
Resume‑PnPWorkflowInstanceResumes a previously stopped workflow instance
Stop‑PnPWorkflowInstanceStops a workflow instance
Add‑PnPWorkflowSubscriptionAdds a workflow subscription to a list
Get‑PnPWorkflowSubscriptionReturns a workflow subscriptions from a list
Remove‑PnPWorkflowSubscriptionRemoves a workflow subscription

Additional resources

© 2017 Microsoft