Scripting: Automate NetScaler configurations with NITRO REST API and PowerShell - Part 2

3:46 PM
Scripting: Automate NetScaler configurations with NITRO REST API and PowerShell - Part 2 -

Part 1: Introduction and first steps

Part 2: Basic Operations and Initial ..

part 3 :. SSL certificates and storefront Load Balancing

Part 4 :. NetScaler Gateway with Storefront configuration

Part 5 :. High Availability configuration

Before we went the NetScaler configuration module on the import and the setting of the management protocol (http or https), we connect the NetScaler appliance. We went to the unit to be connected, while the session object store, and disconnect from the device. Separately, we have Invoke NSNitroRestApi function. Now in Part 2 we will Invoke NSNitroRestApi function in use dip (as part of other NetScaler configuration functions) to perform other basic operations, the first configuration.

Save and restart the NetScaler appliance

to configure the NetScaler save (Save-NSConfig example)

, the NetScaler appliance is driven in large part by the configuration in the ns .conf file. Using the NetScaler configuration module, we can easily save the configuration by calling:

 Save NSConfig -NSSession $ myNSSession 

Restarting the NetScaler appliance (restart NSAppliance example)

to apply for some configurations, how to read the licenses, you must restart the NetScaler appliance. The restart NSAppliance includes functionality to save the configuration before restarting, perform a soft reset and wait until the NetScaler appliance is back online. This can be achieved by calling:

 Restart NSAppliance -NSSession $ myNSSession -SaveNSConfig -WarmReboot -Wait 

Note that after a reboot you need a session with the NetScaler appliance with Connect NSAppliance .

establish

initial

again If a device is brought online first, a start up configuration is required, which contains the NetScaler management IP address (NSIP), Subnet Mask, Gateway and reboot. Then you can go to the Web console with the default username and password will continue the initial configuration. These include a subnet IP address (SNIP), host name, DNS server, and the time zone and licensing.

subnet IP address (Add-NSIPResource example)

Let's say, we want a set of subnet IP 10.108.151.2, with a subnet mask of 255.255.248.0. This is, as we would call it:

 Add-NSIPResource -NSSession $ myNSSession -IPAddress "10.108.151.2" -SubnetMask "255.255.248.0" 

This feature also supports other IP resource types such as MIP and CLIP, among others.

Set the hostname (set NSHostName example)

Next we want to change the hostname in NS1 as follows:

 Set-NSHostName -NSSession $ myNSSession -HostName "NS1" 

Add DNS name Server (Add- NSDNSNameServer example)

In addition, DNS name server can easily address by their IP will be added. This can be called as follows:

 Add-NSDnsNameServer -NSSession $ myNSSession -DNSServerIPAddress "10.8.115.210" 

Or if we multiple DNS server Set:

 "10.8.115.210", "10.8.115.211" | Add-NSDnsNameServer -NSSession $ myNSSession 

to set the time zone (set NSTimeZone example)

are time zones a bit more difficult because we have to know the exact name of the time zone, which we want to set. For a list of time zone names allows you to call Import NSTimeZones that allows returns an array of all time zone values. Once you determine that you would want to set, you can call it as:

 Set-NSTimeZone -NSSession $ myNSSession -TimeZone "GMT-05: 00 EST America / Panama "

Upload licenses (Mail NSLicenseViaPSCP example)

Finally, we would need licenses upload. As of this writing, we would have the license files with your favorite SCP tool upload. So we developed a wrapper function for an example of the use of pscp.exe of putty suite of tools. You must first accept the SSH thumbprint on a previous connection, separate plink.exe execution or otherwise, then you can use the licenses at a similar reputation as upload:

 $ pathtopscp = "C:  Putty  pscp.exe" $ licfiles = @ ( "C:  NSLicense  License1.lic", "C:  NSLicense  License2.lic") $ licfiles | Send NSLicenseViaPSCP -NSIP "10.108.151.1" -NSUsername "nsroot" -NSPassword "nsroot" -PathToPSCP $ pathtopscp 

In the future, LIC file extensions are approved by nitro REST API which means you then call:

 $ licfiles = @ ( "C:  NSLicense  License1.lic", "C:  NSLicense  License2.lic") $ licfiles | Send NSLicense -NSSession $ myNSSession 

activation of NetScaler modes and functions of

activation of NetScaler modes (enable-NSMode example)

To configure different functionality on the NetScaler appliance, you need the corresponding modes by allowing your configuration required. For example, use Subnet enable IP and MAC based forwarding, you can do the following:

 Enable NSMode -NSSession $ myNSSession Feature "USNIP", "MBF" 

activation of NetScaler functions (enable NSFeature example)

Similarly, to enable the corresponding functions required by your configuration. For example, SSL offloading, and to enable load balancing, you can do the following:

 Enable NSFeature -NSSession $ myNSSession Feature "SSL", "LB" 
[1945013 [

Get the sample PowerShell module (part 2)

This module will be updated in the Scripting: Automate NetScaler configurations with NITRO REST API and PowerShell - part 3

Coming up next

we'll go over cases additional use, as we will continue to face more functions in the example PowerShell module.

Happy Scripting!

Santiago Cardenas

Citrix Solutions Lab

Disclaimer:

This software / sample code is provided to you without representations, warranties or conditions of any kind " how it is". You can use, modify and distribute it at your own risk. CITRIX DISCLAIMS ALL WARRANTIES OF ANY KIND, EXPRESS, IMPLIED, WRITTEN, ORAL OR STATUTORY, INCLUDING WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. Without limiting the generality of the foregoing, you acknowledge and agree that (a) the software / code sample could be inaccurate, design flaws or other problems that may cause data loss or damage to property; (B) it may not be possible to make the software / sample code fully functional; and (c) Citrix may, without notice or liability to you, no longer available to make the current version and / or future versions of the software / sample code. In no case the software / code to support ultra-hazardous activities should be used, including but not limited life support or blasting activities. NEITHER CITRIX NOR ITS AFFILIATES OR AGENTS IN BREACH OF CONTRACT OR ANY OTHER LIABILITY FOR DAMAGES RESULTING FROM THE USE OF THE SOFTWARE / SAMPLE CODE, INCLUDING DIRECT, SPECIAL, CONSEQUENTIAL DAMAGES OR OTHER DAMAGES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. You agree to indemnify and defend Citrix against any claims arising from the use, modification or distribution of the code created.

Previous
Next Post »
0 Komentar