-
-
Notifications
You must be signed in to change notification settings - Fork 32
Closed
Labels
Description
When attempting to call Set-NSHostname (or Set-NSTimezone) an error is returned by the Nitro API. I can't find anything concrete, but the API implementation must have changed as I'm sure this used to work? There may be other API calls that are impacted too.
Current Behavior
PS C:\> $ns = Connect-NetScaler -IPAddress 10.200.0.100 -Credential nsroot -PassThru
PS C:\> Set-NSHostname -Session $ns -Hostname ns1.lab.local -Verbose -Force
VERBOSE: URI: http://10.200.0.100/nitro/v1/config/nshostname?action=update
VERBOSE: JSON Payload:
{
"params": {
"onerror": "EXIT",
"warning": "NO"
},
"nshostname": {
"hostname": "ns1.lab.local"
}
}
Invoke-RestMethod : { "errorcode": 1240, "message": "Invalid nitro action or operation", "severity": "ERROR" }
At C:\Program Files\WindowsPowerShell\Modules\netscaler\Private\_InvokeNSRestApi.ps1:144 char:21
+ $response = Invoke-RestMethod @restParams
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebExc
eption
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommandPossible Solution
Removing the -Action update from https://github.com/devblackops/NetScaler/blob/master/NetScaler/Public/Set-NSHostname.ps1#L67 (and https://github.com/devblackops/NetScaler/blob/master/NetScaler/Public/Set-NSTimeZone.ps1#L76) resolves the issue, for example:
_InvokeNSRestApi -Session $Session -Method PUT -Type nshostname -Payload $params # -Action updateYour Environment
- NetScaler version used: 11.0 and 11.1
- Module version used: 1.3.0
- Operating System and PowerShell version: Server 2012 R2 with 5.0.10586.117