HP OneView User Manual
Page 292
$loginVals = query-user
if ($loginVals -eq $null)
{
Write-Host "Error passing user login vals from function query-host, closing program."
return
}
#determines the active Api version
$global:scriptApiVersion = getApiVersion $global:scriptApiVersion $loginVals.hostname
if ($global:scriptApiVersion -eq $null)
{
Write-Host "Could not determine appliance Api version"
return
}
$authinfo = login-appliance $loginVals.userName $loginvals.password $loginVals.hostname
if ($authinfo -eq $null)
{
Write-Host "Error getting authorized session from appliance, closing program."
return
}
$uploadResponse = uploadTo-appliance $loginVals.backupPath $authinfo.sessionID $loginVals.hostname
$loginVals.backupFile
if ($uploadResponse -eq $null)
{
Write-Host "Error attempting to upload, closing program."
return
}
$restoreResponse = start-restore $authinfo.sessionID $loginVals.hostname $uploadResponse
if ($restoreResponse -eq $null)
{
Write-Host "Error obtaining response from Restore request, closing program."
return
}
restore-status -hostname $loginVals.hostname -restoreResponse $restoreResponse -authinfo $authinfo.sessionID
return
}
else
{
Write-Host "Usage: restore.ps1"
Write-Host "or"
Write-Host "restore.ps1 -status https://{ipaddress}"
return
}
292 Backup and restore script examples