Skip to content

New-ScheduledTask Example 2 Incorrect #3899

Open
@PaulDash

Description

@PaulDash

Prerequisites

  • Existing Issue: Search the existing issues for this repository. If there is an issue that fits your needs do not file a new one. Subscribe, react, or comment on that issue instead.
  • Descriptive Title: Write the title for this issue as a short synopsis. If possible, provide context. For example, "Typo in Get-Foo cmdlet" instead of "Typo."
  • Verify Version: If there is a mismatch between documentation and the behavior on your system, ensure that the version you are using is the same as the documentation. Check this box if they match or the issue you are reporting is not version specific.

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue-doc-bugSomething is out of date, unclear, confusing, or broken in the article. Blocks customer success.needs-triageWaiting - Needs triage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions