HP Matrix 7.2 KVM Private Cloud Backup and Restore

Table Of Contents
#loops to keep checking how far the backup has gone
$taskResource = waitFor-completion $taskManager $authValue.sessionID $hostname
if ($taskResource -eq $null)
{
if ($global:interactiveMode -eq 1)
{
Write-Host "Could not fetch backup status"
}
Write-EventLog -EventId 100 -LogName Application -Source backup.ps1 -Message "Could not fetch
backup status"
return
}
#gets the backup resource
$backupResource = get-backupResource $taskResource $authValue.sessionID $hostname
if ($backupResource -eq $null)
{
if ($global:interactiveMode -eq 1)
{
Write-Host "Could not get the Backup Resource"
}
Write-EventLog -EventId 100 -LogName Application -Source backup.ps1 -Message "Could not get
the Backup Resource"
return
}
#downloads the backup file to the local drive
$filePath = download-Backup $backupResource $authValue.sessionID $hostname
if ($filePath -eq $null)
{
if ($global:interactiveMode -eq 1)
{
Write-Host "Could not download the backup"
}
Write-EventLog -EventId 100 -LogName Application -Source backup.ps1 -Message "Could not
download the backup"
return
}
if ($global:interactiveMode -eq 1)
{
Write-Host "Backup can be found at $filePath"
Write-Host "If you wish to automate this script in the future and re-use login settings
currently entered,"
Write-Host "then provide the file path to the saved credentials file when running the
script."
Write-Host "ie: " $MyInvocation.MyCommand.Definition " filepath"
}
else
{
Write-Host "Backup completed successfully."
Write-Host "The backup can be found at $filePath."
}
Write-EventLog -EventId 0 -LogName Application -Source backup.ps1 -Message "script completed
successfully"
Example Output
Enter Appliance name (https://ipaddress)
https://10.10.10.10
Enter Username
*************
Enter password
********
Would you like to save these credentials to a file? (username and password encrypted)
y
Enter file path and file name to save credentials (example:
C:\users\bob\machine1.txt)
C:\users\jerry\jerry-vm.txt
The file 'C:\users\jerry\jerry-vm.txt' already exists.
Overwrite existing credentials for this machine?
y
run backup?
y
Login completed successfully.
48