Complete the code to create a scheduled task action that runs Notepad.
$action = New-ScheduledTaskAction -Execute [1]The New-ScheduledTaskAction cmdlet requires the executable to run. Here, notepad.exe is the correct program to launch Notepad.
Complete the code to register a scheduled task named 'MyTask' with the action stored in $action.
Register-ScheduledTask -TaskName 'MyTask' -Action [1] -Trigger $trigger
The -Action parameter expects the action object, which is stored in $action.
Fix the error in the code to create a daily trigger at 9 AM.
$trigger = New-ScheduledTaskTrigger -Daily -At [1]The -At parameter requires a time in HH:mm format, so 09:00 is correct.
Fill both blanks to create a scheduled task trigger that runs weekly on Monday at 8 AM.
$trigger = New-ScheduledTaskTrigger -Weekly -DaysOfWeek [1] -At [2]
The -DaysOfWeek parameter needs the day name, here Monday, and -At needs the time in HH:mm format, here 08:00.
Fill all three blanks to create a scheduled task with a daily trigger at 7 AM that runs PowerShell with a script path.
$action = New-ScheduledTaskAction -Execute [1] -Argument [2] $trigger = New-ScheduledTaskTrigger -Daily -At [3] Register-ScheduledTask -TaskName 'DailyScript' -Action $action -Trigger $trigger
The action runs powershell.exe with the argument to run a script file -File C:\Scripts\daily.ps1. The trigger is daily at 07:00.