This category contains my articles that, in one way or another, include the usage of PowerShell. That’s a lot of posts – such a large share of what I write about contains different configuration steps, and those are most often easiest to do with PowerShell.
While most of the time there’s a configuration option available using the GUI as well, creating a reusable and debuggable script is generally speaking the preferred option for me.
But what is PowerShell, exactly? If you’re reading this blog, you probably already know I’m not the biggest fan of reinventing the wheel – so I’m not going to reinvent the definition, either. The following is adapted from Microsoft’s documentation for PowerShell:
Windows PowerShell (PowerShell, or PoSh for short) is a Windows command-line shell that includes an interactive prompt and a scripting environment that can be used independently or in combination.
Unlike most shells, which accept and return text, Windows PowerShell is built on top of the .NET Framework common language runtime (CLR) and the .NET Framework, and accepts and returns .NET Framework objects. This makes it a powerful tool for most configuration and automation tasks.
Windows PowerShell introduces the concept of a cmdlet (pronounced “command-let”), a simple, single-function command-line tool built into the shell. You can use each cmdlet separately, but their power is realized when you use these simple tools in combination to perform complex tasks. Straight out of the box there’s over a hundred basic core cmdlets, and you can write your own cmdlets and share them with other users.
The Power of PowerShell certainly does NOT come from the environment itself or the built-in commandlets – not at all. It comes from the hugely useful modules written and published by vendors and community. The ones I mostly use are probably the modules for Azure, SharePoint, Exchange and PnP commandlets.
There are a thousand possible things that can throw a “Microsoft.SharePoint.Client.ServerException”, but fewer things, that are ambiguous enough to be called “Unknown error”. This post describes one fairly usual fix for this issue! But let’s get back to the beginning for a second – you get what and when now?…Continue reading Solving yet another “Microsoft.SharePoint.Client.ServerException: Unknown Error”
Whoops. This could happen to anyone since the Azure PowerShell (approximately) version 6.3.0 will cache your credentials between sessions without warning you. It’s really easy to run your commands with cached accounts and end up executing your scripts against the wrong environment. In less serious cases, this means that you’ll end up…Continue reading Oh no! PowerShell cached my Azure credentials and I messed up wrong customer’s environment!
This was a peculiar case! An issue I hadn’t run into before, and luckily a disturbingly simple fix. But first, let’s set up the scene: We were running a long-ish PowerShell script using a Global Administrator account. One part of the script was supposed to add and deploy a couple…Continue reading How to fix Add-PnPApp failing with an Access Denied error
While running “New-PnPSite” (or actually any other site creation method in PowerShell or programmatically), the site creation fails, and instead you get back an error like the one below: Ouch! Where does this come from? In the code of New-PnPSite, the actual function call is shown below: (Source) So, the…Continue reading New-PnPSite fails with “SiteStatus” : 3?
This post explains how to add new Owners to your Office Groups using PowerShell. If your group has ended up without any owners, PowerShell might even be the only option, since the graphical user interfaces for Office Groups management are not that good. Background The hype around Office Groups kind…Continue reading How to fix an Office Group with no Owners
Have you ever tried to find out the number of users of an enterprise application in your Office 365 tenant? This could be needed for multiple different reasons: maybe your organization is paying for the app and you want to know who’s actually using it, maybe the usage is required…Continue reading How to get the user count for Azure AD Enterprise Application
This article explains how to enable custom scripting for any SharePoint site collection. This is functionally equivalent to setting setting “-DenyAddAndCustomizePages 0” or disabling the NoScript feature. Different instructions and solutions apply to SharePoint Online, and on-premises scenarios (SharePoint Server 2013, 2016, and probably 2019) – so see below for…Continue reading 5 ways to enable Custom Scripts for a SharePoint site collection