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.
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.
- Type powershell in the search box and right-click on the top result to run Windows PowerShell as administrator.
- Then type Install-WindowsFeature Windows-Server-Backup and press Enter. Then wait until the installation process completes.
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
- In Windows PowerShell prompt, type:
☞ add-pssnapin windows.serverbackup
- To confirm that the snap-in was added, at the Windows PowerShell prompt, type:
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.
|Adds a backup target to a backup policy.
|Adds items to a backup policy so that backups that use the policy can perform bare metal recoveries.
|Adds the system state components to the backup policy.
|Gets backups for a server from a location that you specify.
|Gets backup storage locations that you specified as part of a backup policy.
|Gets the current backup operation.
|Removes backups from a target catalog, a system catalog, or both.
|Removes backup storage locations from a backup policy.
|Starts a one-time backup operation.
|Starts a file recovery operation.
I will show you how to starts a one-time backup operation by PowerShell cmdlets.
- Run Windows PowerShell as administrator.
- 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
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.
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.
Then, I will show you how to backup the data on your Server using AOMEI Backupper. Please download and install this software first.
Step 1. Open AOMEI Backupper. Click Backup -> Disk Backup.
Step 2. Tap + Add Disk to choose your Windows Server hard disk to backup.
Step 3. Choose a destination to save the backup.
Step 4. Click Start Backup to back up the data and system of your Windows Server.
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.