Start Powershell script in Task Scheduler

An easy way to get the output from a script in a log file. Save this as a cmd and use it as the trigger.

cd /D %~dp0
powershell.exe -Noninteractive -NoProfile -ExecutionPolicy Bypass -Command ". %~dp0Leaver-Step-3-1.ps1" > "%~dp0Log\scheduledtasklog-Leaver-Step-3-1.txt" 2>&1
exit %ERRORLEVEL