0
0
PowerShellscripting~20 mins

Scheduled task management in PowerShell - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Scheduled Task Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
What is the output of this PowerShell command?
Consider this command that lists scheduled tasks with a specific name filter. What output will it produce?
PowerShell
Get-ScheduledTask -TaskName "Backup*" | Select-Object -ExpandProperty TaskName
A["BackupDaily", "BackupWeekly"]
BError: Get-ScheduledTask : The term 'Get-ScheduledTask' is not recognized
CTaskName : BackupDaily\nTaskName : BackupWeekly
DBackupDaily\nBackupWeekly
Attempts:
2 left
💡 Hint
Think about how Select-Object -ExpandProperty outputs values in PowerShell.
📝 Syntax
intermediate
2:00remaining
Which option correctly creates a scheduled task to run Notepad daily at 9 AM?
Select the PowerShell command that correctly creates a scheduled task named 'OpenNotepad' to run Notepad.exe every day at 9 AM.
ANew-ScheduledTask -TaskName "OpenNotepad" -Trigger (New-ScheduledTaskTrigger -Daily -At 9am) -Action (New-ScheduledTaskAction -Execute "notepad.exe")
BRegister-ScheduledTask -TaskName "OpenNotepad" -Trigger (New-ScheduledTaskTrigger -Daily -At 9am) -Action (New-ScheduledTaskAction -Execute "notepad.exe")
CRegister-ScheduledTask -Name "OpenNotepad" -Trigger (New-ScheduledTaskTrigger -Daily -At 9am) -Action (New-ScheduledTaskAction -Execute "notepad.exe")
DRegister-ScheduledTask -TaskName "OpenNotepad" -Trigger (New-ScheduledTaskTrigger -Daily -At "09:00") -Action (New-ScheduledTaskAction -Execute "notepad.exe")
Attempts:
2 left
💡 Hint
Check the parameter names and formats for Register-ScheduledTask and New-ScheduledTaskTrigger.
🔧 Debug
advanced
2:00remaining
Why does this scheduled task creation script fail?
This script is intended to create a scheduled task that runs a script daily at 7 PM. Why does it fail?
PowerShell
Register-ScheduledTask -TaskName "RunScript" -Trigger (New-ScheduledTaskTrigger -Daily -At "19:00") -Action (New-ScheduledTaskAction -Execute "powershell.exe" -Argument "-File C:\Scripts\daily.ps1")
AThe -At parameter requires time in quotes when containing ':'; it should be -At "19:00".
BThe -Argument parameter must be an array, not a string.
CThe path in -Argument must be escaped with double backslashes.
DThe script fails because Register-ScheduledTask requires -User and -Password parameters.
Attempts:
2 left
💡 Hint
Check the format expected by the -At parameter in New-ScheduledTaskTrigger.
🚀 Application
advanced
2:00remaining
How to disable a scheduled task using PowerShell?
You want to disable a scheduled task named 'DataSync'. Which command will do this correctly?
ADisable-ScheduledTask -TaskName "DataSync"
BSet-ScheduledTask -TaskName "DataSync" -Enabled $false
CStop-ScheduledTask -TaskName "DataSync"
DRemove-ScheduledTask -TaskName "DataSync"
Attempts:
2 left
💡 Hint
Disabling a task means it won't run but still exists.
🧠 Conceptual
expert
3:00remaining
What is the effect of this PowerShell snippet on scheduled tasks?
What does this script do? $tasks = Get-ScheduledTask | Where-Object { $_.State -eq 'Ready' -and $_.TaskName -like '*Backup*' } foreach ($task in $tasks) { Disable-ScheduledTask -TaskName $task.TaskName }
AEnables all scheduled tasks with 'Backup' in their name that are currently disabled.
BDeletes all scheduled tasks with 'Backup' in their name that are currently ready to run.
CDisables all scheduled tasks with 'Backup' in their name that are currently ready to run.
DStarts all scheduled tasks with 'Backup' in their name that are currently ready.
Attempts:
2 left
💡 Hint
Look at the filtering and the command inside the loop.