Schedule a PowerShell script execution

Creation of a scheduled task (Windows 2008 only)

Import-Module TaskScheduler
$Script = "ToBeDefined"

$task = New-Task
$task.Settings.Hidden = $true

Add-TaskAction -Task $task -Path powershell.exe -Arguments "-File $Script"
# Daily Execution, 8AM
Add-TaskTrigger -Task $task -Daily -At "08:00"

Register-ScheduledTask -Name "PowerShell Task - $Script" -Task $task

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top