Every group of questions: IDE FAQ
Scripts in a job
Section titled “Scripts in a job”Can I run my own PowerShell scripts in a job?
Yes, in a PowerShell Step. The script can read SMART Migration Variables, set them, and write to the session log while it runs. Your own script runs under any execution policy; a script that loads a module such as PnP.PowerShell needs RemoteSigned — in PowerShell started as administrator, Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine.
Read more: PowerShell · PowerShell samples
How do I pass Variables between a job and my script?
$MyVariable = Get-FlowVariable -Name "[<My Variable>]" reads a SMART Migration Variable into PowerShell, and Set-FlowVariable -Name "[<My Variable>]" -Value $MyVariable writes one back. Variables of type Password can be read — their value is not written to the console — but not set.
Read more: Get-FlowVariable · Set-FlowVariable
How do I write to the session log from a script?
With Add-FlowLogRow -LogType "Information" -Message "…". It is asynchronous, so you follow the script's progress in the Step's Job tab as it runs. -LogType can also be Warning, Error (handled as the Step's On error setting says), StopJob, which stops the job, or ExitGroup, which leaves the current Group Step.
Read more: Add-FlowLogRow
SharePoint from PowerShell
Section titled “SharePoint from PowerShell”How do I connect to SharePoint from a script?
With Connect-PnPOnline, using a SMART Migration SharePoint connection: SMART Migration generates the commands that fetch its authentication details — Get-FlowSPConnection with -Property Url, AppId or AppSecret — and builds the Connect-PnPOnline statement from them.
Read more: Connect-PnPOnline from SMART Migration · PowerShell samples
What do I need to install for PnP PowerShell?
PowerShell 7.2 or later — winget install --id Microsoft.Powershell --source winget in PowerShell run as administrator — then the PnP.PowerShell module, and an execution policy that lets the module load: RemoteSigned, with Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine (Restricted, the Windows 11 default, blocks it). Visual Studio Code is needed only to customise the modules.
Read more: PnP.PowerShell installation