Sample script – HP OneView User Manual
Page 327
Example 9 “Sample restore.ps1 script”
provides a sample script that restores the appliance from
a backup file or obtains progress about an ongoing restore process.
Sample script
If you do not pass parameters to the script, the script uploads and restores a backup file.
1.
Calls query-user() to get the appliance host name, user name and password, and backup
file path.
2.
Calls login-appliance() to issue a REST request to get a session ID used to authorize
restore REST calls.
3.
Calls uploadTo-appliance() to upload the backup to the appliance.
4.
Calls start-restore() to start the restore.
5.
Calls restore-status() to periodically check the restore status until the restore completes.
If you pass the -status option to the script, the script verifies and reports the status of the last or
an ongoing restore until the restore process is complete:
1.
Calls recover-restoreID() to get the URI to verify the status of the last or an ongoing
restore.
2.
Calls restore-status() to periodically verify the restore status until the restore completes.
C.2 Sample restore script 327