Preparing your environment for SharePoint Online scripting is very simple.
Setting up your environment
PowerShell execution policy
As the preferred scripting tool for administrators, PowerShell security is paramount. We will review the execution policy in depth in Chapter 6, Script Automation, but by default it restricts scripts to running only in an interactive session.
In this mode, you cannot execute scripts in .ps1 files (not even in the interactive mode) and unattended scripts will be blocked.
In the following example, we attempt to execute the HelloWorld.ps1 file. The call is blocked and the error message suggests that you look into the execution policy setting.
In the next line, we use the Get-ExecutionPolicy command...