-
Notifications
You must be signed in to change notification settings - Fork 634
New-ScheduledTask Example 2 Incorrect #3899
Copy link
Copy link
Open
Labels
issue-doc-bugSomething is out of date, unclear, confusing, or broken in the article. Blocks customer success.Something is out of date, unclear, confusing, or broken in the article. Blocks customer success.needs-triageWaiting - Needs triageWaiting - Needs triage
Metadata
Metadata
Assignees
Labels
issue-doc-bugSomething is out of date, unclear, confusing, or broken in the article. Blocks customer success.Something is out of date, unclear, confusing, or broken in the article. Blocks customer success.needs-triageWaiting - Needs triageWaiting - Needs triage
Type
Fields
Give feedbackNo fields configured for issues without a type.
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.