NetScaler Scripting

Last Modified: Jun 2, 2017 @ 10:28 am

Navigation

ūüí° = Recently Updated

NetScaler Configuration Extractor

For a crude Single HTML page that can extract configuration from a ns.conf file, see http://www.carlstalhood.com/NetScalerExtractor.html. This page runs completely on the client side so nothing is uploaded. Or you can download the HTML page and run it on your machine.

Configure NetScaler from PowerShell

You can use any scripting language that supports REST calls. This section is based on PowerShell 3 and its Invoke-RestMethod cmdlet.

CTP Esther Barthel maintains a PowerShell module for NetScaler at¬†https://github.com/cognitionIT/PS-NITRO. See Citrix Synergy TV – SYN325 – Automating NetScaler: talking NITRO with PowerShell for an overview.¬†ūüí°

The below NetScalerPowerShell.zip contains PowerShell functions that use REST calls to configure a NetScaler appliance. It only takes a few seconds to wipe a NetScaler and configure it with almost everything detailed on this site. A glaring omission is file operations including licenses, certificate files, and customized monitor scripts and the PowerShell script assumes these files are already present on the appliance.

Most of the functions should work on 10.5 and 11.0 with a few obvious exceptions like RDP Proxy. Here are some other differences between 10.5 and 11.0:

  • PUT operations in NetScaler 11 do not need an entity name in the URL; however 10.5 does require entity names in every PUT URL.
  • https URL for REST calls works without issue in NetScaler 11, but NetScaler 10.5 had inconsistent errors. http works without issue in NetScaler 10.5.

Nitro REST API Documentation

NetScaler Nitro REST API documentation can be found on any NetScaler by clicking the Downloads tab. The documentation is updated whenever you upgrade your firmware.

Look for the Nitro API Documentation.

Extract the files, and then launch index.html.

Start by reading the Getting Started Guide, and then expand the Configuration node to see detailed documentation for every REST call.

The Nitro API is also documented at REST Web Services at Citrix Docs.

2 thoughts on “NetScaler Scripting”

  1. Hey Carl,

    For the headers in my version of powershell, it threw an error (the content-type=application/vnd/etc)

    The fix was to use the -content-type [String] flag rather than the dictionary object to specify the content-type header. Hope this helps anyone else running into the error I was facing yesterday.

    For reference, the error was “The ‘content-Type’ header must be modified using the appropriate property or method.

    -Trey

Leave a Reply