I have a folder with a PowerShell script and a .cmd file that executes it (among other things).
I want task scheduler to launch Run.cmd but it won't work. Manually launching Run.cmd works and so does launching just the .ps1 by itself. Here is how I set up my task scheduler:
Additional information:
The script backs-up our network switches
The .ps1 by its nature throws up a few non-critical errors (doesn't stop the script)
Run.cmd is this:
@echo off powershell.exe -ExecutionPolicy Bypass -file "BackupSwitch.ps1" %SystemRoot%\System32\tree.com "%~dp0backups" /f TIMEOUT /t 10