PowerShell cmdlets for Data Protection for Microsoft Hyper-V

Review the Data Protection for Microsoft Hyper-V cmdlets that you can use to protect your virtual machine (VM) data.

The following table identifies the cmdlets that are available for Data Protection for Microsoft Hyper-V.

Table 1. PowerShell cmdlets for Data Protection for Microsoft Hyper-V
Cmdlet name Description
Backup-DpHvVm Back up a Hyper-V VM.

Related command: dsmc backup vm

Get-DpHvBackup Show information about a VM backup.

Related command: dsmc query vm

Get-DpHvBackupSchedule Show a list of eligible backup schedules for the VMs in the Hyper-V host or cluster.

An eligible schedule must be defined by the IBM Spectrum Protect™ server administrator, and it must be defined for a domain that is targeted for Hyper-V VMs.

The schedule definition must include the following parameters and options:

  • The -domain.vmfull="all-vm" option must be specified in the option string.
  • The schedule must contain the ACTION=BACKUP and SUBACTION=VM parameters.
Get-DpHvHostConfiguration Show the configuration information for the Hyper-V host from the IBM Spectrum Protect server.
Get-DpHvIaVm Show the list of VMs that are in instant access mode. Attributes about the VMs are also displayed.

Instant access VMs are temporary VMs that are created for instant access operations. For more information, see Example 14: Verify the integrity of a VM backup by running cmdlets.

Get-DpHvLastSuccessfulBackup Show information about recent VM backup operations that ran in a host or cluster.

The following information is returned: the at-risk status of the VM backup, the backup date, the duration of the backup, the amount of data that was transmitted, the type of backup, the host that the VM belongs to (for clusters), and the name of the schedule that ran.

Get-DpHvLog Return the error log entries for a node. You can save the log entries to a file and specify a file name.
Get-DpHVLogSection Return a section of the error log when you specify the starting line number and how many lines to display.
Get-DpHvPolicyDomain Show a list of policy domains on the IBM Spectrum Protect server.

Related command: dsmadmc q domain

Get-DpHvRCInfo Show information about a return code.
Get-DpHvScheduleHistory Show a list of schedules that ran.

Each schedule that is returned can contain the time that the schedule started to run, the name of the schedule, the status of the schedule, the number of VMs that were backed up or failed to back up, and the duration of the schedule run.

Get-DpHvScheduleHistoryDetail Show information for each VM that was backed up in a schedule run.

Each backup task that is returned can contain the name of the VM, the status of the backup, the start time of the backup, and error codes for backups that failed.

Get-DpHvTask Show general information about completed and running tasks.
Get-DpHvVvm Show information about the VM inventory on the Hyper-V host.

Related command: dsmc show vm

Get-DpHvVMAtRisk Show the current at-risk policy for the VM. The at-risk policy determines when a VM backup is shown as at-risk if a backup operation did not occur in a specified time interval.

The at-risk policy consists of an at-risk type. The at-risk type is a number and can be 0 (BYPASS), 1 (CUSTOM), or 2 (DEFAULT). Custom at-risk types have an at-risk interval in hours.

Get-DpHvVMBackupHistory Show the backup history for a VM from the summary extended table on the IBM Spectrum Protect server.

Each backup task that is returned can contain the last run time of a backup, the status of the backup, the duration of the backup, the amount of data that was transmitted, the host that the VM belongs to (for clusters), and any error codes that were returned.

Get-DpHvVmBackupTaskHistory Show the VM backup task history that is stored locally on Data Protection for Microsoft Hyper-V.
Get-DpHvVmRestoreTaskHistory Show the VM restore task history that is stored locally on Data Protection for Microsoft Hyper-V.
New-DpHvFsInfo Create an FsInfo object for use with the Set-DpHvVmAtRisk cmdlet. The FsInfo object specifies the IBM Spectrum Protect file space ID and the name of the VM for which to set the at-risk policy.
New-DpHvNodeInfo Create a NodeInfo object for use with the Set-DpHvHostConfiguration cmdlet. The NodeInfo object specifies the node name and node type on the Hyper-V host.
New-DpHvSession Authenticate to Data Protection for Microsoft Hyper-V and start a PowerShell cmdlet session.
Receive-DpHvTask Monitor the backup or restore task.
Remove-DpHvSession Close the session with Data Protection for Microsoft Hyper-V.
Restore-DpHvVm Restore a Hyper-V VM.

You can also verify whether a VM backup can be restored by running instant access operations. For more information, see Example 14: Verify the integrity of a VM backup by running cmdlets.

Related command: dsmc restore vm

Set-DpHvBackupSchedule Associate a schedule with a data mover on a Hyper-V host or cluster.

You can associate a node with a schedule, remove a node from the schedule, and associate a target node with a schedule.

Set-DpHvHostConfiguration Configure the Hyper-V host for Data Protection for Microsoft Hyper-V operations.
Set-DpHvHttpsPort Set the HTTPS port that is used for the IBM Spectrum Protect web server.
Set-DpHvMmcLoginPreferences Set the preferences for the Data Protection for Microsoft Hyper-V Management Console.
Set-DpHvVmAtRisk Set the at-risk policy for one or more VMs. The at-risk policy determines when a VM backup is shown as at-risk if a backup operation did not occur in a specified time interval.

The at-risk policy consists of an at-risk type. The at-risk type is a number and can be 0 (BYPASS), 1 (CUSTOM), or 2 (DEFAULT). Custom at-risk types have an at-risk interval in hours.

Set-ServerConnection Store IBM Spectrum Protect server connection information on the Hyper-V host and verify the connection to the server.
Show-DpHvHttpsPort Show the port information for the IBM Spectrum Protect web server.
Show-DpHvMmcLoginPreferences Show the preferences for the Data Protection for Microsoft Hyper-V Management Console.
Stop-DpHvTask Cancel a backup or restore task.
Test-DpHvConfiguration Verify the configuration for Data Protection for Microsoft Hyper-V.
Test-DomainCredentials Verify the credentials for the Windows domain user.

For the list of common tasks for the cmdlets, see Data Protection for Microsoft Hyper-V cmdlet examples.

Getting help information for PowerShell cmdlets

Online help is provided for the PowerShell cmdlets. To view the details about a specific cmdlet, run the Get-Help cmdlet with the cmdlet name:
Get-Help cmdlet_name
For example:
Get-Help Backup-DpHvVm
The following examples are for the Backup-DpHvVm cmdlet. To see cmdlet examples, enter:
Get-Help Backup-DpHvVm -examples
For detailed information, enter:
Get-Help Backup-DpHvVm -detailed
For technical information, enter:
Get-Help Backup-DpHvVm -full
For online product information, enter:
Get-Help Backup-DpHvVm -online
For information about a specific parameter, such as the IFINCREMENTAL parameter, enter:
help Backup-DpHvVm -Parameter IFINCREMENTAL

To show the help in a separate window, include the -ShowWindow parameter with the help command.