0
0
PowerShellscripting~10 mins

Scheduled task management in PowerShell - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create a scheduled task action that runs Notepad.

PowerShell
$action = New-ScheduledTaskAction -Execute [1]
Drag options to blanks, or click blank then click option'
Acmd.exe
Bcalc.exe
Cexplorer.exe
Dnotepad.exe
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong executable name like 'calc.exe' or 'cmd.exe'.
Forgetting to specify the executable.
2fill in blank
medium

Complete the code to register a scheduled task named 'MyTask' with the action stored in $action.

PowerShell
Register-ScheduledTask -TaskName 'MyTask' -Action [1] -Trigger $trigger
Drag options to blanks, or click blank then click option'
A$action
B$trigger
C$task
D$schedule
Attempts:
3 left
💡 Hint
Common Mistakes
Passing the trigger object instead of the action.
Using an undefined variable.
3fill in blank
hard

Fix the error in the code to create a daily trigger at 9 AM.

PowerShell
$trigger = New-ScheduledTaskTrigger -Daily -At [1]
Drag options to blanks, or click blank then click option'
A09:00
B9
C9 AM
D09:00AM
Attempts:
3 left
💡 Hint
Common Mistakes
Using '9' without minutes.
Using '9 AM' which is not the correct format.
4fill in blank
hard

Fill both blanks to create a scheduled task trigger that runs weekly on Monday at 8 AM.

PowerShell
$trigger = New-ScheduledTaskTrigger -Weekly -DaysOfWeek [1] -At [2]
Drag options to blanks, or click blank then click option'
AMonday
BTuesday
C08:00
D9:00
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong day name.
Using incorrect time format like '9:00'.
5fill in blank
hard

Fill all three blanks to create a scheduled task with a daily trigger at 7 AM that runs PowerShell with a script path.

PowerShell
$action = New-ScheduledTaskAction -Execute [1] -Argument [2]
$trigger = New-ScheduledTaskTrigger -Daily -At [3]
Register-ScheduledTask -TaskName 'DailyScript' -Action $action -Trigger $trigger
Drag options to blanks, or click blank then click option'
Apowershell.exe
B-File C:\Scripts\daily.ps1
C07:00
D-Command "Get-Process"
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong executable or argument.
Incorrect time format.
Mixing up argument options.