How to Take Windows Server Backup Using PowerShell

This article will show you how to install and configure Windows Server Backup using PowerShell to protect data on your servers. It also provides reliable third-party software to back up your server. If you are interested, please continue reading.

Maggie

by Maggie Updated on September 22, 2023

Share this: instagram reddit

Overview of Windows Server Backup

Windows Server Backup (WSB) is a feature that provides backup and recovery options for Windows server environments. You can use it to back up a full server (all volumes), selected volumes, the system state, or specific files or folders—and to create a bare metal backup that you can use for bare metal recovery. You can recover volumes, folders, files, certain applications, and the system state.

Windows Server Backup is designed for everyone who needs a basic backup solution (from small businesses to large enterprises), but even for small organizations or individuals who are not IT professionals.

How to Install Windows Server Backup Using PowerShell

Performing Windows Server backups is an important part of daily Windows Server management. Backup allows you to recover lost data from disaster scenarios such as hardware failure, software failure, human error, and computer virus.

To prepare for server backup, you need to install the Windows Server Backup feature first. After installation, you can access Windows PowerShell cmdlets for Windows Server Backup. To install this feature, using PowerShell is the easiest way.

  1. Type powershell in the search box and right-click on the top result to run Windows PowerShell as administrator.

Open Windows PowerShell

  1. Then type Install-WindowsFeature Windows-Server-Backup and press Enter. Then wait until the installation process completes.

Install Windows Server Backup

How to Configure Windows Server Backup by PowerShell Cmdlets

After installing Windows Server Backup on your server, you can use Windows PowerShell cmdlets for Windows Server Backup to automate and manage backups. The cmdlets for Windows Server Backup are contained in a Windows PowerShell snap-in. You need to import the PowerShell snap-in.

#1. Add the Windows Server Backup Cmdlet snap-in to Windows PowerShell

  1. In Windows PowerShell prompt, type:

☞ add-pssnapin windows.serverbackup

  1. To confirm that the snap-in was added, at the Windows PowerShell prompt, type:

☞ get-pssnapin

Windows PowerShell Snap-in

Once this is done, you are ready to start with the Server Backup cmdlets.

#2. Configure Windows Server Backup using PowerShell Cmdlets

The cmdlet descriptions and syntax of some Windows Server Backup cmdlets are provided below for reference. If you want to learn about all cmdlets, click here.

Add-WBBackupTarget: Adds a backup target to a backup policy.
Add-WBBareMetalRecovery: Adds items to a backup policy so that backups that use the policy can perform bare metal recoveries.
Add-WBSystemState: Adds the system state components to the backup policy.
Get-WBBackupSet: Gets backups for a server from a location that you specify.
Get-WBBackupTarget: Gets backup storage locations that you specified as part of a backup policy.
Get-WBJob: Gets the current backup operation.
Remove-WBBackupSet: Removes backups from a target catalog, a system catalog, or both.
Remove-WBBackupTarget: Removes backup storage locations from a backup policy.
Start-WBBackup: Starts a one-time backup operation.
Start-WBFileRecovery: Starts a file recovery operation.

I will show you how to starts a one-time backup operation by PowerShell cmdlets.

  1. Run Windows PowerShell as administrator.
  2. Type the following commands in order, and then press Enter after each command.

● The first command creates a new backup policy object and stores it in a variable named $Policy.
   PS C:\> $Policy = New-WBPolicy

● This command adds the current system state options to the backup policy in the $Policy variable.
   PS C:\> Add-WBSystemState $Policy

● This command adds the ability to perform a bare-metal recovery to the backup policy in the $Policy variable.
   PS C:\> Add-WBBareMetalRecovery $Policy

● This command creates a new backup location object that contains the volume that has the drive letter E and then stores that object in the $BackupLocation variable.
   PS C:\> $BackupLocation = New-WBBackupTarget -VolumePath "E:"

● This command adds the backup target based on the backup policy in the $Policy variable and the backup location in the $BackupLocation variable.
   PS C:\> Add-WBBackupTarget -Policy $Policy -Target $BackupLocation

● This command specifies that the backup policy in the $Policy variable uses Volume Shadow Copy Service (VSS) copy backups.
   PS C:\> Set-WBVssBackupOptions -Policy $Policy -VssCopyBackup

● This command starts the backup by using the backup policy in the $Policy variable.
   PS C:\> Start-WBBackup -Policy $Policy

Start a One Time Backup

This example starts a backup by using new settings.

The observed attack appears to have implemented CVE-2022-41040 to gain privileged access and CVE-2022-41082 to perform remote code execution via PowerShell. 

Warning:  The Patch Tuesday, November 2022 reportedly fixes 69 Windows vulnerabilities. Among them, The CVE-2022-41040, and CVE-2022-41082 on Microsoft Exchange Server allows authenticated attackers to run Powershell command. And the attacker can potentially gain access to other resources via lateral movement into Exchange and Active Directory environments.

Most Reliable Windows Server Backup Alternative-AOMEI Backupper

As shown above, if you are not familiar with computer technology or skills, using Windows Server Backup with PowerShell for data protection will be a bit troublesome. And you need to remember a lot of cmdlets to complete the backup process.

Here, I recommend to you a more convenient and simpler way to protect your servers. AOMEI Backupper Server is a full-featured backup and restore software for Windows Server 2003, 2008, 2012, 2016, 2019, 2022 (including R2) and all Windows PCs (all 32-bit and 64-bit versions). You can use this software to backup your server with just a few clicks. Let's take a brief look at what powerful functions it has.

It supports you to back up Server to different storages. For instance, backup Server to QNAP NAS, external hard drive, network share, cloud service, etc. No matter what accidents happen, you can restore your backups from these places.
It allows you to schedule backup. You can use Daily/Weekly/Monthly schedule backup or Event trigger and USB plug in feature.
It provides incremental and differential backup modes to copy only changed files to ensure you always have the changes made on your server.

Then, I will show you how to backup the data on your Server using AOMEI Backupper. Please download and install this software first.

Download Free Trial Windows Server & PC
Secure Download

Step 1. Open AOMEI Backupper. Click Backup -> Disk Backup.

Disk Backup

Tip✍: if you just want to backup your Windows Server operating system, please select System Backup. The program will automatically select the system partitions by default

Step 2. Tap + Add Disk to choose your Windows Server hard disk to backup.

Add Disk

Step 3. Choose a destination to save the backup.

Select Backup Destination

Step 4. Click Start Backup to back up the data and system of your Windows Server.

Start Backup

Helpful tips:
Options: You could add a comment for your backup and use other backup settings, such as compression, splitting, and encryption.
Scheme: You can set backup method (Full/Incremental/Differential Backup) or delete old backup images (by quality, by time or by daily/weekly/monthly) for more space.

To Sum Up

That’s all for taking Windows Server Backup using PowerShell. You can use Windows Server Backup with PowerShell cmdlets to back up your server. And this article also provides you with an alternative to Windows Server Backup to help you protect your data and system.

By comparing the backup process of the two, it is not difficult to find that the latter is simpler and easier to operate. AOMEI Backupper is a powerful backup software for all Windows Servers and PCs. In addition to the backup function, it also has functions such as cloning, synchronization, and recovery. You can use it to create a Windows Server recovery disk and boot from it in the event of an accident.

Maggie
Maggie · Editor
Maggie is a technical editor from AOMEI and troubleshoots technical problems against data protection. She has received professional and systematic technical training. With a focus on user experience, security, and problem-solving, she always puts herself in the readers' shoes and provides them with valuable technical insights.