0
0
PowerShellscripting~30 mins

Scheduled task management in PowerShell - Mini Project: Build & Apply

Choose your learning style9 modes available
Scheduled task management
📖 Scenario: You work in IT support. You need to manage scheduled tasks on a Windows computer to automate daily reports.
🎯 Goal: Build a PowerShell script that creates a scheduled task to run a report script daily, checks the task status, and displays the task details.
📋 What You'll Learn
Create a scheduled task action to run a script
Set a daily trigger for the scheduled task
Register the scheduled task with a specific name
Query the scheduled task status
Display the scheduled task details
💡 Why This Matters
🌍 Real World
Automating daily reports or maintenance tasks on Windows computers saves time and reduces manual work.
💼 Career
IT professionals and system administrators often create and manage scheduled tasks to automate routine jobs.
Progress0 / 4 steps
1
Create the scheduled task action
Create a variable called $action that defines a scheduled task action to run the program powershell.exe with the argument -File C:\Scripts\DailyReport.ps1.
PowerShell
Need a hint?

Use New-ScheduledTaskAction with -Execute and -Argument parameters.

2
Create a daily trigger for the task
Create a variable called $trigger that sets a daily scheduled task trigger to start at 8:00 AM.
PowerShell
Need a hint?

Use New-ScheduledTaskTrigger with -Daily and -At 8am.

3
Register the scheduled task
Use Register-ScheduledTask to create a scheduled task named DailyReportTask using the variables $action and $trigger. Store the registered task in a variable called $task.
PowerShell
Need a hint?

Use Register-ScheduledTask with -TaskName, -Action, and -Trigger.

4
Display the scheduled task details
Use Get-ScheduledTask to get the task named DailyReportTask and then use Get-ScheduledTaskInfo to get its status. Print both the task and its status.
PowerShell
Need a hint?

Use Get-ScheduledTask and Get-ScheduledTaskInfo with -TaskName 'DailyReportTask'. Use Write-Output to print.