HP Matrix 7.2 KVM Private Cloud Backup and Restore

Table Of Contents
$bkupURI = "/backup/rest/resources/"
$fullBackupURI = $hostname + $bkupURI
# create a new webrequest and add the proper headers (new header, auth, is needed for
authorization
# in all functions from this point on)
try
{
$rawTaskResource = setup-request -Uri $fullBackupURI -method "POST" -accept
"application/json" -contentType "application/json" -authValue $authValue
if ($rawTaskResource -ne $null)
{
$rawTaskResource | convertFrom-Json
}
}
catch [System.Exception]
{
if ($global:interactiveMode -eq 1)
{
Write-Host $error[0].Exception.Message
}
else
{
Write-EventLog -EventId 100 -LogName Application -Source backup.ps1 -Message
$error[0].Exception.Message
}
}
}
##### Polling to see if backup is finished ######
function waitFor-completion ([object]$taskManager,[string]$authValue,[string]$hostname)
{
<#
.DESCRIPTION
Checks the status of the backup every five seconds, stops when status changes from
running to a different status
.PARAMETER taskManager
The response object from the backup-appliance method
.PARAMETER authValue
The authorized session ID
.PARAMETER hostname
The appliance to connect to (in https://{ipaddress} format)
.INPUTS
None, does not accept piping
.OUTPUTS
The task resource object, which contains the URI to get the backup resource in the
next function
.EXAMPLE
$responseobject = waitFor-Completion $taskManager $sessionID $hostname
#>
# appends the URI to the IP address, creates a webrequest with appropriate headers
$backupStatusURI = $taskManager.uri
$fullStatusURI = $hostname + $backupStatusURI
$errorCount = 0
$errorMessage = ""
if ($global:interactiveMode -eq 1)
{
Write-Host "Backup initiated."
Write-Host "Checking for backup completion, this may take a while."
}
# a while loop to determine when the backup process is finished
do
{
try
{
# creates a new webrequest with appropriate headers
41