Bird
0
0

You wrote this command to schedule a script:

medium📝 Debug Q14 of 15
PowerShell - Automation Patterns
You wrote this command to schedule a script:
schtasks /create /tn "DailyReport" /tr "powershell.exe C:\Scripts\report.ps1" /sc daily /st 09:00

But the task does not run at 9 AM. What is the likely error?
AUsing /sc daily instead of /sc hourly
BMissing the -File parameter before the script path in /tr
CTask name "DailyReport" is invalid
DStart time format 09:00 is incorrect
Step-by-Step Solution
Solution:
  1. Step 1: Check the /tr argument syntax

    The PowerShell command should include -File before the script path to run it properly.
  2. Step 2: Understand why missing -File causes failure

    Without -File, PowerShell does not know to execute the script file, so the task runs but does nothing.
  3. Final Answer:

    Missing the -File parameter before the script path in /tr -> Option B
  4. Quick Check:

    PowerShell needs -File to run script [OK]
Quick Trick: Always include -File before script path in /tr [OK]
Common Mistakes:
  • Omitting -File in PowerShell command
  • Changing schedule type unnecessarily
  • Assuming task name or time format is wrong

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes