invoke

PowerShell: Create Windows Scheduled Task to run Powershell script every hour

If you are using a newer version of PowerShell, then by all means use the New-ScheduledTaskAction, New-ScheduledTaskTrigger, and Register-ScheduledTask and  to create a Windows schedule task using PS scripting. But if you still need to be compatible back to PowerShell 2.0, and want to keep it simple, you can avoid using the Schedule.Service COM interface, PowerShell: Create Windows Scheduled Task to run Powershell script every hour