Last Update: Nov 19, 2024 | Published: Jan 18, 2018
In my last article at Petri.com, I introduced some of the usage scenarios we can face when managing SharePoint Online (SPO) using PowerShell. In this article, I will describe some of the Tools (Figure 1) we can use to run our SPO PowerShell Scripts.
So, let’s talk a little bit about each of the tools represented in Figure 1:
Windows PowerShell refers not only to a command-line shell tool for Windows but also to a scripting language that has become a standard to manage almost any Microsoft platform (OnPremises and in the Cloud). You can execute SPO default cmdlets in the native Windows PowerShell shell whenever you first install the SPO Management Shell. Note: You can download last SPO Management Shell from here.
Figure 2 — Executing SPO Cmdlets in Windows PowerShell
Of course, you can also execute any PowerShell Script that uses any of the SPO APIs:
SPO Management Shell is the default PowerShell shell provided by Microsoft to execute latest SPO cmdlets against a SPO tenant. It’s updated quite often by Microsoft (at the time of writing, last update available was release on the 21st of December). This means that we have to keep an eye on the usual channels used by the SPO Dev Team to communicate that a new version of the SPO Management Shell is available. From there, we can update it on our machines. Note: Microsoft does not currently provide a built-in mechanism to update the SPO Management Shell with last available update.
The Windows PowerShell Integrated Scripting Environment (ISE) is just a host application for Windows PowerShell that is available by default in modern Windows OS such as Windows 10 or Windows Server 2016. Some of the features of Windows PowerShell ISE are the following:
As happens with previous tools, we can use Windows PowerShell ISE to execute SPO cmdlets or just write and execute PowerShell scripts where SPO APIs are used.
Figure 3 — Running in Microsoft PowerShell ISE a PowerShell Script that Uses CSOM SPO API
Visual Studio is still the most used IDE (Integrated Development Environment) for many .NET developers and it also allows to write, test, and debug PowerShell scripts and modules. PowerShell support in Visual Studio is provided by means of the PowerShell Tools for Visual Studio that are available in the Visual Studio Market Place:
Some features provided by PowerShell Tools for Visual Studio are:
Again, in Visual Studio it is possible to execute standard SPO cmdlets and also write, test, and debug PowerShell Scripts where SPO APIs are used.
Figure 4 — Using SPO Standard Cmdlets in Visual Studio
If Visual Studio is still the most used IDE by most .NET Developers, Visual Studio Code is also becoming popular among developers. As happens with Visual Studio, Visual Studio Code allows to write, test, and debug PowerShell scripts and modules. This is possible thanks to the PowerShell extensions for Visual Studio Code available also at the Visual Studio marketplace:
Once you install the PowerShell extensions for Visual Studio Code, you get the following features:
As happens with Visual Studio, Visual Studio Code allows to execute not only scripts where standard SPO PowerShell cmdlets and/or SPO APIs.
Figure 5 — Running a PowerShell Script for SPO in Visual Studio Code
Additionally, to the PowerShell Tools for SPO provided by Microsoft, there are other third-party tools that could be used to manage SPO. The following are examples of those third-party tools (some are free, but others are not):
We can work with PowerShell for SPO by using any of the development environments provided by Microsoft. If you ask my recommendation about what tool to use, I would say Windows PowerShell ISE or Visual Studio Code. Finally, there are also third-party tools to run PowerShell scripts and modules for SPO.