PnP PowerShell and more...

Here I occasionally post about Microsoft 365 Patterns and Practices in general and PnP PowerShell more specifically.

Speed tip for PnP PowerShell

2022-12-06 1 min read PowerShell
Did you know that retrieving 20 list items like this for($i=1;$i -lt 20;$i++) { Get-PnPListItem -List "My List" -Id $i } is so much slower than $list = Get-PnPList "My List" for($i=1;$i -lt 20;$i++) { Get-PnPListLitem -List $list -Id $i } ? The reason behind this is that the cmdlet Get-PnPListItem for every execution where you use the name ‘My List’ will have to make an extra call to the server to figure out the details about that list before it is able to retrieve the item. Continue reading

PowerShell: Debugging Tip

2020-10-13 2 min read PowerShell
When I work on PnP PowerShell (https://github.com/pnp/powershell) I code either in VSCode or in Visual Studio as I write the cmdlets in C#. During development I need to debug the cmdlets I’m building so I need to attach the debugger to the PowerShell session where I run my cmdlets. If there is one PowerShell window/tab running, then there is no problem. However… When I run multiple PowerShell sessions (no surprise: I most of the time do…) then which process do I attach to? Continue reading

PowerShell: Easy Navigation Between Folders

2020-10-13 2 min read PowerShell
If you, like me, have a folder where you navigate to a lot in PowerShell maybe this tip is a handy one for you. The folder in my case contains my GitHub/Code repositories. I navigate around on my computer with PowerShell, but sometimes I simply want to jump back to that location from wherever I am, without needing to enter something like cd c:\users\erwin\repositories\myrepositoryfolder etc. etc. Wouldn’t it be nicer if you get enter something alike repo myrepositoryfolder instead? Continue reading

Cross Platform PnP PowerShell Released

2020-10-09 5 min read PowerShell
After close to more than 2 years or work we finally are ready to release a preview build of PnP PowerShell for PowerShell Core! (Check out the original post) Why did it take so long? A few factors came into play here. At the MVP Summit in Redmond in 2018 I already demoed a version of PnP PowerShell running on MacOS. For that we needed to a few things: We needed to have the Microsoft Client Object Model for SharePoint library (CSOM) available for . Continue reading

Setting up your Office 365 CDN with PnP Provisioning or PnP PowerShell

2018-03-27 2 min read PowerShell SharePoint
The upcoming build of the PnP Provisioning Engine now allows you to configure your tenant CDN settings through a template. In this short post I show you how to configure your CDN with both the PnP Provisioning Engine and PnP PowerShell PnP Provisioning While the current schema (2018-01) already supports these elements, the actual engine does not implement them yet. We will release this functionality in the April 2018 (2. Continue reading

PnP PowerShell vs SharePoint Online Management Shell

2018-03-23 2 min read PowerShell
Well, it’s not really a matter of one versus the other. When we started of with PnP PowerShell, we used the -SPO prefix in the cmdlets, the same as what the by Microsoft provided SharePoint Online Management Shell is using. And while that worked quite okay, we ran into an issue when we released the Get-SPOSite cmdlet. That one was available already in the SharePoint Online Management Shell. Result: conflict. Which one should PowerShell use? Continue reading

Automatic Context Switching in PnP PowerShell

2018-03-21 2 min read PowerShell SharePoint
PnP PowerShell does something we call ‘context switching’. Let me show you how this is making your life a tiny bit easier: Connect-PnPOnline https://contoso.sharepoint.com Get-PnPList Get-PnPTenantSite This will connect first to your root site collection in your tenant, return all the lists in the site, and then the next cmdlet will show you all the (classic) site collections in your tenant. Normally you would have to connect (if you’re a developer, you have to create a new ClientContext) to your tenant admin site first in order to do this. Continue reading
Older posts