First Time Use of PowerShell, SharePoint On-Premises
A PowerShell with SharePoint tutorial
The
PowerShell cmdlets for SharePoint On-premises are written
for PowerShell V5.1, so for On-premises SharePoint, PowerShell
scripts can be created in the Windows app PowerShell ISE.
This set-up is used for most of the demos in this Tips series,
but if you have SharePoint Online the first use is different,
refer to the
previous demo.
In the demo below, Peter Kalmström shows how to find PowerShell
ISE and how to write a script that changes the default execution
policy.
Peter starts with a short overview of how the PowerShell
ISE app is used. After that he writes a line of script and
runs it.
By default, you are not allowed to run scripts on a Windows
computer, so before you can run any scripts you must allow
that. As this is a PowerShell tutorial, Peter will of course
do that with a script, and that is the first script you
must run when you start using PowerShell.
Set-ExecutionPolicy -ExecutionPolicy Unrestricted
Before you start using PowerShell with SharePoint, you should
also install the SharePointPnPPowerShell module. This is
a library of PowerShell commands that allows you to perform
complex provisioning and artifact management actions towards
SharePoint.
Install-Module SharePointPnPPowerShellOnline
In the demo below, Peter Kalmström shows one way of downloading
and installing SharePointPnPPowerShell. He also explains
how to connect the SharePointPnPPowerShell module to a SharePoint
site and check the connection.
When SharePointPnPPowerShell has been installed on the computer,
it is imported to PowerShell each time it should be used
and connected to the SharePoint site you want to work with.
Import-Module SharePointPnPPowerShellOnline
Connect-PnPOnline PATH
|
 |

|
|