With the release of NetScaler 11.1 there was a new API module available which I haven’t seen before which was “install” API which allows us to handle upgrades/downgrades of NetScaler versions using the NITRO API.
There isn’t so much about it on the docs yet, luckily I got some response from the NetScaler team on the NetScaler masterclass today and I got the link I was looking for in the documentation.
The simplest way to do this now (If you don’t have MAS or Command Center) is to do it using PowerShell note this does not apply for CPX I have another blog coming there later on.
For this to work I placed my latest netscaler firmware on an IIS servere which all HTTP request have access to the file. So I placed the firmware under C:\inetpub\wwwroot on a specific computer. Then I can reference that in the NITRO API.
There aren’t so many parameters available in the API call, you just need to specify where to get the firmware and specify if you want to force the upgrade and enable callhome.
I’ve been using the PowerShell cmdlets on Github which you can find here https://github.com/santiagocardenas/netscaler-configuration
So basically just added another function to it. If you want to try it out without using the entire PowerShell cmdlet you can use this. Simple and split into two functions. (NOTE I HAVE HARDCODED THE VARIABLES SO YOU SEE WHICH TO CHANGE AND ADD YOURSELVES )
function Login-NS {
# Login to the NetScaler
$body = ConvertTo-JSON @{
“login”=@{
“username”=”nsroot”;
“password”=”nsroot”
}
}
Invoke-RestMethod -uri “10.217.215.171/nitro/v1/config/login” -body $body -SessionVariable NSSession `
-Headers @{“Content-Type”=”application/vnd.com.citrix.netscaler.login+json”} -Method POST
$Script:NSSession = $local:NSSession
}
function upgrade-NS {
$body = @{
“install”=@{
“url”=”http://10.217.215.106/build-11.1-47.14_nc.tgz”
“y”=”true”
}
}
$body = ConvertTo-JSON $body
Invoke-RestMethod -uri “10.217.215.171/nitro/v1/config/install” -body $body -WebSession $NSSession `
-Headers @{“Content-Type”=”application/json”} -Method POST
}
So basically just run Login-NS (Where you change the variables username and password and same with URI and IP address) and since you need to authenticate against the NetScaler first. Then the second command which is upgrade-NS which fetches the firmware from 106 using that filename and then asks the 171 NetScaler to get the firmware from that location.