Prerequisites
Links
https://learn.microsoft.com/en-us/powershell/module/scheduledtasks/new-scheduledtask?view=winserver2012-ps#examples
Summary
Example 2 states that two scripts will be run. The scripts will open in an editor.
Details
The example description states that:
This example creates and registers a scheduled task that runs two PowerShell scripts daily at 09:15 AM.
Meanwhile, using New-ScheduledTaskAction -Execute 'foo.ps1' will only launch the editor associated with .ps1 files on a given system and will not execute the script.
Suggested Fix
The example should show how to execute pwsh.exe (or powershell.exe for older versions) along with arguments that point to executing the scripts. The example can then be expanded to show how to save the output generated by those scripts.
Prerequisites
Get-Foocmdlet" instead of "Typo."Links
https://learn.microsoft.com/en-us/powershell/module/scheduledtasks/new-scheduledtask?view=winserver2012-ps#examples
Summary
Example 2 states that two scripts will be run. The scripts will open in an editor.
Details
The example description states that:
This example creates and registers a scheduled task that runs two PowerShell scripts daily at 09:15 AM.
Meanwhile, using
New-ScheduledTaskAction -Execute 'foo.ps1'will only launch the editor associated with .ps1 files on a given system and will not execute the script.Suggested Fix
The example should show how to execute pwsh.exe (or powershell.exe for older versions) along with arguments that point to executing the scripts. The example can then be expanded to show how to save the output generated by those scripts.