When running a simple PowerShell script from Task Scheduler, I would like to redirect the output to a file.
There is a long thread about this very topic here, yet i
Here is the command that worked for me. I didn't like the idea of redirecting the output in the script, since it would make it difficult to run manually.
powershell -windowstyle minimized -c "powershell -c .\myscript.ps1 -verbose >> \\server\myscript.log 2>&1"