Hp OneView Manual do Utilizador Página 284

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 307
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 283
{
# creates a new webrequest with appropriate headers
$taskResourceJson = setup-request -Uri $fullTaskUri -method "GET" -accept "application/json" -authValue
$authValue -isSilent $true
# converts the response from the Appliance into a hash table
$taskResource = $taskResourceJson | convertFrom-Json
# checks the status of the task manager
$status = $taskResource.taskState
}
catch
{
$errorMessage = $error[0].Exception.Message
$errorCount = $errorCount + 1
$status = "RequestFailed"
Start-Sleep -s 15
continue
}
# Update progress bar
if ($global:interactiveMode -eq 1)
{
$trimmedPercent = ($taskResource.completedSteps) / 5
$progressBar = "[" + "=" * $trimmedPercent + " " * (20 - $trimmedPercent) + "]"
Write-Host "`r Backup progress: $progressBar " $taskResource.completedSteps "%" -NoNewline
}
# Reset the error count since progress information was successfully retrieved
$errorCount = 0
# If the backup is still running, wait a bit, and then check again
if ($status -eq "Running")
{
Start-Sleep -s 20
}
} while (($status -eq "Running" -or $status -eq "RequestFailed") -and $errorCount -lt 20);
# if the backup reported an abnormal state, report the state and exit function
if ($status -ne "Completed")
{
if ($global:interactiveMode -eq 1)
{
Write-Host "`n"
Write-Host "Backup stopped abnormally"
Write-Host $errorMessage
}
else
{
#log error message
Write-EventLog -EventId 100 -LogName Application -Source backup.ps1 -Message "Backup stopped abnormally"
Write-EventLog -EventId 100 -LogName Application -Source backup.ps1 -Message $errorMessage
}
return $null
}
# upon successful completion of task, outputs a hash table which contains task resource
else
{
Write-Host "`n"
$taskResource
return
}
}
##### Gets the backup resource #####
function get-backupResource ([object]$taskResource,[string]$authValue,[string]$hostname)
{
<#
.DESCRIPTION
Gets the Uri for the backup resource from the task resource and gets the backup resource
.PARAMETER taskResource
The task resource object that we use to get the Uri for the backup resource
.PARAMETER authValue
The authorized sessionID
.PARAMETER hostname
the appliance to connect to (in https://{ipaddress} format)
.INPUTS
None, does not accept piping
.OUTPUTS
The backup resource object
.EXAMPLE
$backupResource = get-BackupResource $taskResource $sessionID $applianceName
284 Ejemplos de secuencias de comandos de copia de seguridad y restauración
Vista de página 283
1 2 ... 279 280 281 282 283 284 285 286 287 288 289 ... 306 307

Comentários a estes Manuais

Sem comentários