Skip to content

Creating and updating scheduled tasks using PowerShell

License

Notifications You must be signed in to change notification settings

TomasHubelbauer/powershell-scheduled-tasks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

Manage Scheduled Tasks in Windows using Powershell

Create

$action = New-ScheduledTaskAction -Execute "notepad" -Argument "file.txt"
$now = Get-Date
$interval = New-TimeSpan -Seconds 5
$forever = [System.TimeSpan]::MaxValue
$trigger = New-ScheduledTaskTrigger -Once -At $now -RepetitionInterval $interval -RepetitionDuration $forever
$settings = New-ScheduledTaskSettingsSet
$task = New-ScheduledTask -Action $action -Trigger $trigger -Settings $settings
Register-ScheduledTask -TaskName 'TEST' -InputObject $task

Can't use : in the task name!

List

Get-ScheduledTask
schtasks /query
Get-ScheduledTask -TaskName "Tom - *"

Sources

To-Do

Await Stack Overflow help on scheduling the task

https://stackoverflow.com/q/59569150/2715716

About

Creating and updating scheduled tasks using PowerShell

Topics

Resources

License

Stars

Watchers

Forks