Skip to content
Contact us

PowerShell

Use the PowerShell Step to embed your own scripts.

Section titled “Use the PowerShell Step to embed your own scripts.”

A PowerShell Step runs your own script under any execution policy. A script that loads a module — PnP.PowerShell for SharePoint, for example — needs a policy that lets modules load: RemoteSigned, the default on Windows Server. Restricted, the default on Windows 11, blocks the module's files, and the script stops with "the module could not be loaded".

Set it for the whole machine, so the job server's service account has it too: start PowerShell as administrator and run

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine

Read more: PnP PowerShell installation · Microsoft: about execution policies

Notice you can pass SMART Migration variables into PowerShell variables, push results back into SMART Migration variables. Also, you can write to the Session log from you script asynchronously so you can monitor the progress as the script executes.

CMDLETSMART Migration built-in PowerShell CMDLETs to interface your scripts
Get-FlowVariableAssign the value from a SMART Migration Variable to a PowerShell variable.
Set-FlowVariableAssign the value from a PowerShell variable to a SMART Migration Variable.
Add-FlowLogRowAdd a row to the SMART Migration Session Log. You can optionally set the outcome of the PowerShell Step to Ok/Warning/Error
Connect-PnPOnlineConnect to SharePoint from PowerShell using a SMART Migration connection

PowerShell samples