locked
Using Windows Task Scheduler to run PS1 Script - Getting Error RRS feed

  • Question

  • Hello Team,

    I am new to Powershell and hopefully this is a simple enough problem on my end that you can help me solve. I have the PowerShell script build and its running fine when I run it via the Task Scheduler. My issue is that in Task Scheduler I have provided Action to Start Powershell.exe and below Option:

    -ExecutionPolicy Unrestricted -NoExit C:\Backups\Scripts\TSMBackup_Daily.ps1


    Due to above I get the below error message:

    Task Scheduler did not launch task "\Daily – Backup" because instance "{0ffb0fe2-b48b-40ba-a97a-08bd1ded01a5}" of the same task is already running.


    Is this due to "-NoExit" defined above? if so is there a way to stop the task once the script is ran?
    Thursday, October 3, 2019 4:13 PM

Answers

  • Simple answer - yes.

    "Execution Policy should be "Bypass"

    Note that this is not a Task Scheduler forum.  It is for questions about a script and not for questions about how to use the operating system services or utilities.


    \_(ツ)_/

    • Marked as answer by ankit43 Thursday, October 3, 2019 5:06 PM
    Thursday, October 3, 2019 4:47 PM

All replies

  • Simple answer - yes.

    "Execution Policy should be "Bypass"

    Note that this is not a Task Scheduler forum.  It is for questions about a script and not for questions about how to use the operating system services or utilities.


    \_(ツ)_/

    • Marked as answer by ankit43 Thursday, October 3, 2019 5:06 PM
    Thursday, October 3, 2019 4:47 PM
  • Got it - sorry I found similar Task Scheduler question in forum tree:  Windows Server > Windows PowerShell

    - will ensure to post it in OS Services or Utilities going forward.

    Thursday, October 3, 2019 5:08 PM