Blog

SharePoint Intranet: Patterns & Practices PowerShell Cmdlets

By Cathy Dew on April 18, 2017

What Are PnP PowerShell Cmdlets and What Do They Mean for Your SharePoint Intranet?

Are you looking for a more effective way to manage your SharePoint intranet remotely? If so, then you might consider delving into the possibilities of Patterns & Practices PowerShell Cmdlets. PnP PowerShell CmdLets (as they are abbreviated) are essentially automated scripts that can carry out key SharePoint management functions on their own. To get a better idea of what PnP PowerShell Cmdlets does, go to this page of available Cmdlets. As you will see, there are cmdlets for a wide range of applications, from managing content types to enabling or disabling features on your intranet.

What Are Patterns & Practices PowerShell Cmdlets

Now you have some idea of what Patterns & Practices PowerShell Cdlets can do, but you might still not be entirely clear on what they are. After all, the description of “automated scripts” isn’t exactly detailed.

One of the reasons that PnP PowerShell CmdLets are difficult to understand at first is that they are not features designed by Microsoft for SharePoint. Instead, the PnP PowerShell Cmdlet projects are completely open source and community-driven. The page linked above, where you can review and download available cmdlets, is a GitHub page rather than a Microsoft Support page. The scripts that make up the PowerShell CmdLet library, meanwhile, are crafted by users or community coordinators rather than by Microsoft’s key SharePoint consultants and team members.

The community/open source nature of the Patterns & Practices program does mean that Microsoft didn’t specifically design the PowerShell Cmndlets in-house. However, there is no reason to be wary about using the cmdlet library provided at the above GitHub link. These scripts have been used, proven, and endorsed by many SharePoint users. The open source nature of the community also lends extra versatility to the Pnp PowerShell CmdLet library. Because independent developers can create and publish new cmdlets as they are needed, there are cmdlets for managing virtually every SharePoint asset—from SharePoint documents to entire sites.

Possible Applications for PowerShell Cmdlets

With hundreds of different cmdlets at your disposal, it is possible to carry out many, many SharePoint actions remotely, just by activating the scripts. Here are just a few of the applications for which you can use the cmdlets from the PnP PowerShell library:

  • Branding Teamsites in Bulk: As you will see browsing the PnP PowerShell library on GitHub, there is an entire section of cmdlets devoted to branding. These cmdlets will enable you to create custom actions on your sites, manage menus, make bulk changes to aesthetic and theme, and more.
  • Theme / Color Pallet Design: There are two cmdlets in the “Branding” category that deal with the theme of your SharePoint sites. These cmdlets are Get-PnPTheme and Set-PnPTheme. Set-PnPTheme is especially helpful, allowing you 1) to set the theme of a site or site collection and 2) to update all subsites so that they will inherit the theme. Just like that, you can apply background images, fonts, color schemes, and more to bulk web pages on your intranet.
  • Storage of Files: Just like there is a “Branding” section to the cmdlet library, there is also a “Files and Folders” section. These cmdlets are designed to help you manage the storage of your SharePoint documents and files. For instance, Move-PnPFile moves a file from one location to another, while Add-PnPFile uploads a new file to your SharePoint intranet. Other cmdlets in this category can delete files, add or move folders, download new files, and more.
  • File Naming Conventions: Are you in the process of updating your libraries and folders so that all files match the same naming conventions? The cmdlets Rename-PnPFile and Rename-PnPFolder make it easy to rename SharePoint documents or folders without altering the path locations.

The list of possible automated actions for SharePoint’s PowerShell cmdlets goes on and on. Start browsing the library on GitHub to get more of an idea of what you can do with these cmdlets.

Connecting Your Site to Use Cmdlets

By default, your SharePoint site or intranet is not set up to use PnP PowerShell cmdlet scripts. As such, if you wish to use cmdlets to automate some of your SharePoint management tasks, you will need to create a site connection. Said another way, you need to use PowerShell commands to create a context in which you can use cmdlets.

Luckily, there is a cmdlet that you can type into PowerShell to create this context and pave the way for any other cmdlets you wish to use. The cmdlet is Connect-PnPOnline, and it will essentially create a connection between your SharePoint site and PowerShell. Go here to learn exactly how to use this cmdlet. You will be asked to enter your credentials when you set up the context, but can also configure PowerShell so that you don’t have to input credentials every single time you want to use a PnP cmdlet.

Start Using Cmdlets for Your SharePoint Intranet

Once you’ve set up the PowerShell context as discussed above, you can start using Patterns & Practices cmdlets to automate certain actions and management tasks for your SharePoint. For instance, you can use a PowerShell script to collect all your site collections into one list, or a combination of cmdlets to customize and apply branding choices throughout your SharePoint environment.

No matter what you are aiming to accomplish by using the SharePoint 2016 List of All available PowerShell cmdlets, our SharePoint consultants at 2Plus2 can help. Whether you need assistance setting up PowerShell, creating the context in which cmdlets can be used, or applying different cmdlets to automate key SharePoint intranet tasks, we are here to lend a hand.

Go online to schedule a free consultation with our team or call 510-652-7700 today.

Cathy Dew
Cathy Dew – CEO + Information Architect
Cathy focuses the company on our mission – Real results. Every time. Information architect and strategist, Cathy is passionate about making software work well – the function, the feel, the result.