BackupsWindows Server BackupRestore7 min read

Configure Windows Server Backup

Configure Windows Server Backup for automatic system and data copies.


Windows Server Backup lets you create backups of the entire system or specific folders with automatic scheduling.

Step 1 — Install the feature

powershell
Install-WindowsFeature Windows-Server-Backup -IncludeManagementTools

Step 2 — Full system backup

powershell
# System state backup to disk
wbadmin start systemstatebackup -backupTarget:E: -quiet

Step 3 — Backup specific folders

powershell
# Backup data folders
wbadmin start backup -backupTarget:E: -include:C:\inetpub,C:\apps,C:\data -quiet

Step 4 — Schedule automatic backup

powershell
# Create daily backup policy at 2 AM
$policy = New-WBPolicy
$target = New-WBBackupTarget -VolumePath E:
Add-WBBackupTarget -Policy $policy -Target $target

# Include C: volume
$volume = Get-WBVolume -VolumePath C:
Add-WBVolume -Policy $policy -Volume $volume

# Schedule at 2:00 AM
Set-WBSchedule -Policy $policy -Schedule 02:00

# Apply policy
Set-WBPolicy -Policy $policy -Force

Step 5 — Backup with PowerShell script

Create C:\Scripts\backup-data.ps1:

powershell
$date = Get-Date -Format "yyyy-MM-dd"
$sources = @("C:\inetpub", "C:\apps", "C:\data")
$destination = "E:\Backups\$date"

New-Item -Path $destination -ItemType Directory -Force

foreach ($dir in $sources) {
    $name = Split-Path $dir -Leaf
    Copy-Item -Path $dir -Destination "$destination\$name" -Recurse -Force
    Write-Host "Copied: $dir"
}

# Compress
Compress-Archive -Path "$destination\*" -DestinationPath "$destination.zip" -Force
Remove-Item -Path $destination -Recurse -Force

Write-Host "Backup completed: $destination.zip"

Step 6 — Schedule with Task Scheduler

powershell
$action = New-ScheduledTaskAction -Execute "PowerShell.exe" -Argument "-NoProfile -ExecutionPolicy Bypass -File C:\Scripts\backup-data.ps1"
$trigger = New-ScheduledTaskTrigger -Daily -At 3:00AM
Register-ScheduledTask -TaskName "Daily Backup" -Action $action -Trigger $trigger -User "SYSTEM" -RunLevel Highest

Step 7 — Restore from backup

powershell
# List available backups
wbadmin get versions

# Restore specific files
wbadmin start recovery -version:MM/DD/YYYY-HH:MM -itemType:File -items:C:\apps\config.json -recoveryTarget:C:\temp -quiet

Backup retention

powershell
# Delete backups older than 30 days
Get-ChildItem E:\Backups\*.zip | Where-Object { $_.LastWriteTime -lt (Get-Date).AddDays(-30) } | Remove-Item

Keep regular backups of your Baires Host Windows VPS to protect your data against any incident.


Was this guide helpful?