Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
# confirm disks
PS C:\Users\Administrator> Get-WBDisk
DiskName : VMware Virtual NVMe Disk
DiskNumber : 0
DiskId : 709e4dfd-d548-42b6-9342-bd165be3c5ba
TotalSpace : 128849018880
FreeSpace : 109411463680
Volumes : {EFI System Partition, Local disk (C:)}
ContainsBackup : False
BackupVolumeId : 00000000-0000-0000-0000-000000000000
Properties : ContainsOemPartition, ContainsCriticalVolume
DiskName : VMware Virtual NVMe Disk
DiskNumber : 1
DiskId : 02661949-94dd-430f-989e-c24cf220bf6c
TotalSpace : 85899345920
FreeSpace : 71359353344
Volumes : {Local Disk (D:)}
ContainsBackup : False
BackupVolumeId : 00000000-0000-0000-0000-000000000000
Properties : ValidTarget
# set disks to a disk object
PS C:\Users\Administrator> $Disks = Get-WBDisk
# set empty backup policy object
PS C:\Users\Administrator> $Policy = New-WBPolicy
# add current system state to the backup policy
PS C:\Users\Administrator> Add-WBSystemState -Policy $Policy
# add baremetal revovery to the backup policy
PS C:\Users\Administrator> Add-WBBareMetalRecovery -Policy $Policy
# add source files/folders/volumes to take backup to the backup policy
# example follows specifies C dirive all
PS C:\Users\Administrator> New-WBFileSpec -FileSpec "C:" | Add-WBFileSpec -Policy $Policy
# set Volume Shadow Copy Service (VSS) option to the backup policy
PS C:\Users\Administrator> Set-WBVssBackupOptions -Policy $Policy -VssCopyBackup
# set backup tagret Path
# example below specifies local disk
# specify a disk from the result of [Get-WBDisk]
PS C:\Users\Administrator> $BackupLocation = New-WBBackupTarget -Disk $Disks[1]
# add backup tagret to the backup policy
PS C:\Users\Administrator> Add-WBBackupTarget -Policy $Policy -Target $BackupLocation
Label :
WBDisk : VMware Virtual NVMe Disk
WBVolume :
Path :
TargetType : Disk
InheritAcl : False
PreserveExistingBackup : False
# confirm configured backup policy
PS C:\Users\Administrator> $Policy
Schedule :
BackupTargets : {VMware Virtual NVMe Disk}
VolumesToBackup :
FilesSpecsToBackup : {C:*}
FilesSpecsToExclude : {}
ComponentsToBackup :
BMR : True
SystemState : True
OverwriteOldFormatVhd : False
VssBackupOptions : VssCopyBackup
# set schedule for backup policy
# for multiple schedule, specify times with comma separated
PS C:\Users\Administrator> Set-WBSchedule -Policy $Policy -Schedule 01:30
Wednesday, December 21, 2022 1:30:00 AM
# set backup policy
PS C:\Users\Administrator> Set-WBPolicy -Policy $Policy
Warning
Do you want to format the backup storage disk VMware Virtual NVMe Disk?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): Y
# confirm configured backup policy
PS C:\Users\Administrator> Get-WBPolicy
Schedule : {12/21/2022 1:30:00 AM}
BackupTargets : {rx- 12/21/2022 9:01:36 PM Disk01}
VolumesToBackup : {EFI System Partition, Local disk (C:), (Disk does not have drive letter)
(\\?\Volume{1fc33f07-cb61-4747-b878-7e8337269bb1}\)}
FilesSpecsToBackup : {}
FilesSpecsToExclude : {}
ComponentsToBackup : {}
BMR : True
SystemState : True
OverwriteOldFormatVhd : False
VssBackupOptions : VssCopyBackup
|