HP Insight Control Server Provisioning 7.3 Update 1 Installation Guide

Table Of Contents
#########################################################################################
# attempt to login and exit if error during login.
Write-Host "Sending login request.."
$loginresponse = $webclient.uploadString($loginurl, $loginbody)
if( !$loginresponse) { Write-Host "*** ERROR *** Login Failed"; exit; }
Write-Host " login successful"
#########################################################################################
# extract token from response
$bodytokens = $loginresponse.split("`"")
$token = $bodytokens[3]
#########################################################################################
# make all subsequent requests with the auth token
$webclient.Headers.add('auth', "$token")
#################################################
# Now do the upload
$uploadurl = "https://$ip/rest/appliance/firmware/image"
$webclient.Headers.set('content-type', 'application/octet-stream')
$webclient.Headers.add('accept-language', 'en-us')
Write-Host "Sending upload request..."
try
{
$loginresponse = $webclient.uploadFile($uploadurl, $filename)
}
catch
{
Write-Host ""
Write-Host "** ERROR ** Upload failed!"
Write-Host $_.Exception.Message
exit
}
Write-Host " upload request successful"
REST API call to upload the update file 37