Task Scheduler runs scripts or programs automatically at a set time, at startup, or on events — useful for backups, log rotation, or controlled reboots on your Windows VPS.
Typical use cases
- Copy folders to another disk or share
- Export configuration or database dumps
- Compress or rotate log files
Method 1: Graphical UI
- Open Task Scheduler (
taskschd.msc). - Create Task… (for full control; not only “Create Basic Task”).
- General tab: name e.g.
Daily backup, check Run with highest privileges if needed. - Triggers tab: New… → Daily at your time.
- Actions tab: New… → Start a program
- Program:
powershell.exe - Arguments:
-ExecutionPolicy Bypass -File "C:\Scripts\backup.ps1"
- Program:
- Conditions / Settings: disable sleep-related blocks if the task must run without an interactive user.
Method 2: PowerShell (daily at 3:00 AM)
Create C:\Scripts\backup.ps1 (minimal example — adapt):
PowerShell$dest = "D:\Backups" New-Item -ItemType Directory -Force -Path $dest | Out-Null Copy-Item -Path "C:\inetpub\mysite" -Destination (Join-Path $dest ("site_" + (Get-Date -Format "yyyyMMdd"))) -Recurse -Force
Register the task:
PowerShell$action = New-ScheduledTaskAction -Execute "powershell.exe" -Argument '-ExecutionPolicy Bypass -File "C:\Scripts\backup.ps1"' $trigger = New-ScheduledTaskTrigger -Daily -At 3am $principal = New-ScheduledTaskPrincipal -UserId "SYSTEM" -LogonType ServiceAccount -RunLevel Highest Register-ScheduledTask -TaskName "DailySiteBackup" -Action $action -Trigger $trigger -Principal $principal
Verify:
PowerShellGet-ScheduledTask -TaskName "DailySiteBackup" Start-ScheduledTask -TaskName "DailySiteBackup"
Best practices
- Run the script manually before scheduling.
- Log output to a file inside the
.ps1. - Protect scripts that contain secrets; use service accounts with least privilege.
Our Windows VPS are available in the same 8 locations: Windows VPS France, Windows VPS Germany, Windows VPS Netherlands, Windows VPS United Kingdom, Windows VPS USA, Windows VPS Canada, Windows VPS Turkey and Windows VPS Hong Kong. Desktop editions are offered too: Windows 10 RDP and Windows 11 RDP.
Troubleshooting
- Task does not run: check Event Viewer → Windows Logs → Application and Task Scheduler operational log.
- Error 0x1: often wrong path, missing script, or execution policy; use
-ExecutionPolicy Bypassas above.
See also initial Windows VPS setup.