Last active
December 7, 2021 20:32
-
-
Save JohnL4/049badf447e9136607327018f7a8e4b9 to your computer and use it in GitHub Desktop.
Notes on scheduling a PowerShell script with Windows Task Scheduler
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The program to run is: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe (or wherever the PS executable is on your system) | |
The arguments are: -NoProfile -File Run-ScheduledScript.ps1 | |
Run-ScheduledScript is where you redirect all your output streams to a log file using the '*>' PowerShell redirect operator | |
(or some variant thereof). | |
Maybe "*>&1" to merge everything to the SUCCESS stream, followed by "| Out-File -width 200 -encoding oem" or something equally creative. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment