Windows VPSCreate Scheduled Tasks on Windows Server
Guide to automating a Windows Server VPS at Lordhosting with scheduled tasks: Task Scheduler, PowerShell, backup, restart and cleanup scripts, and reading the run history.
On a Windows Server VPS, scheduled tasks automate everything that must run without you: nightly backups, restarting a service, cleaning up logs. It is the equivalent of cron on Linux. This guide covers creation through the interface and through PowerShell, with ready-to-use scripts.
⚙️ Requirements
- A Lordhosting VPS running Windows Server with administrator RDP access
- Ideally, IIS installed if you are automating a web server
⚙️ 1. Open Task Scheduler
Press Win + R, type taskschd.msc and confirm. The Task Scheduler Library lists all existing tasks.
⚙️ 2. Create a simple task (interface)
In the right pane, click Create Basic Task, then follow the wizard:
- Name: give a clear name (e.g. "Daily Backup").
- Trigger: choose the frequency (daily, at logon, on event…).
- Action: "Start a program".
- Program/script: the path to your executable or script.
Open the task properties, General tab, and tick "Run whether user is logged on or not". Essential for a task that must run at night.
⚙️ 3. Manage tasks in PowerShell
Faster and scriptable. Create a task that runs a script every night at 3 a.m.:
$action = New-ScheduledTaskAction -Execute "powershell.exe" `
-Argument "-ExecutionPolicy Bypass -File C:\scripts\backup.ps1"
$trigger = New-ScheduledTaskTrigger -Daily -At 3am
Register-ScheduledTask -TaskName "Daily Backup" -Action $action -Trigger $trigger `
-User "SYSTEM" -RunLevel Highest
Manage existing tasks:
Get-ScheduledTask # list tasks
Start-ScheduledTask -TaskName "Daily Backup" # run now
Unregister-ScheduledTask -TaskName "Daily Backup" -Confirm:$false # delete
⚙️ 4. Useful scripts
A compressed backup of a folder:
$date = Get-Date -Format "yyyy-MM-dd"
Compress-Archive -Path "C:\inetpub\mysite" -DestinationPath "D:\backups\site-$date.zip" -Force
Restart a crashed service:
Restart-Service -Name "W3SVC" # the IIS service
Clean up old log files (older than 30 days):
Get-ChildItem "C:\logs" -Recurse -File |
Where-Object { $_.LastWriteTime -lt (Get-Date).AddDays(-30) } |
Remove-Item -Force
⚙️ 5. Read the run history
In Task Scheduler, select your task then the History tab: every run appears with its return code. Enable history via "Enable All Tasks History" in the right pane if it is empty.
✅ Conclusion
You now know how to automate your Windows VPS: backups, restarts and cleanups run on their own, at night, and you check them in the history. Combine these tasks with an IIS web server for fully automated administration.
Need a reliable Windows server? Our Windows VPS are delivered in minutes with RDP included and full administrator access.
❗Always good to know

