{"id":21071819,"url":"https://github.com/devblackops/netscaler","last_synced_at":"2025-11-02T17:02:13.888Z","repository":{"id":1780420,"uuid":"44791918","full_name":"devblackops/NetScaler","owner":"devblackops","description":"PowerShell module for interacting with Citrix NetScaler via the Nitro API","archived":false,"fork":false,"pushed_at":"2022-06-04T04:15:18.000Z","size":1313,"stargazers_count":70,"open_issues_count":18,"forks_count":31,"subscribers_count":19,"default_branch":"master","last_synced_at":"2025-04-03T20:51:16.399Z","etag":null,"topics":["citrix-netscaler","netscaler","nitro-api","powershell"],"latest_commit_sha":null,"homepage":null,"language":"PowerShell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devblackops.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-10-23T05:05:46.000Z","updated_at":"2024-11-14T20:50:51.000Z","dependencies_parsed_at":"2022-09-25T03:40:42.819Z","dependency_job_id":null,"html_url":"https://github.com/devblackops/NetScaler","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devblackops%2FNetScaler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devblackops%2FNetScaler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devblackops%2FNetScaler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devblackops%2FNetScaler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devblackops","download_url":"https://codeload.github.com/devblackops/NetScaler/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254474437,"owners_count":22077279,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["citrix-netscaler","netscaler","nitro-api","powershell"],"created_at":"2024-11-19T18:54:19.936Z","updated_at":"2025-11-02T17:02:08.837Z","avatar_url":"https://github.com/devblackops.png","language":"PowerShell","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build status](https://ci.appveyor.com/api/projects/status/a6oio0l6g27nhg0w?svg=true)](https://ci.appveyor.com/project/devblackops/netscaler)\n\n# NetScaler\n\nPowerShell module for interacting with Citrix NetScaler via the Nitro API.\n\nThis module contains functions that abstract away the nitty-gritty aspects of \nthe Nitro API. It provides a set of idiomatic PowerShell functions with \nparameter validation and inline documentation. The module can be used for both\na better command line experience and writing scripts that automate NetScaler\nsetup.\n\n# Getting started\n\n## Login into NetScaler\n\nThis script establishes a session with the NetScaler instance and sets its host name:\n\n```powershell\n$Nsip, $Username, $Password = \"1.2.3.4\", \"nsroot\", \"nsroot\"\n\n$SecurePassword = ConvertTo-SecureString $Password -AsPlainText -Force\n$Credential = New-Object System.Management.Automation.PSCredential ($Username, $SecurePassword)\n\n$Session =  Connect-Netscaler -Hostname $Nsip -Credential $Credential -PassThru\n\nSet-NSHostname -Hostname ns01 -Force -Session $Session\n```\n\n## Initial setup\n\nOnce logged into a freshly installed NetScaler, the following script sets up the time zone, \ninstalls a license, saves the configuration and reboots:\n\n```powershell\nSet-NSTimeZone -TimeZone 'GMT+01:00-CET-Europe/Zurich' -Session $Session -Force\n\nInstall-NSLicense -Path licenses/license.lic -Session $Session\nRestart-NetScaler -WarmReboot -Wait -SaveConfig -Session $Session -Force\n```\n\nAfter reboot, a reconnection is required:\n\n```powershell\n$Session =  Connect-Netscaler -Hostname $Nsip -Credential $Credential -PassThru\n```\n\n## Basic tasks\n\nOnce initial setup is done, regular configuration can start. The following commands \nwill set up a VIP and SNIP:\n\n```powershell\nAdd-NSIPResource -Type SNIP -IPAddress 172.16.124.11 -SubNetMask '255.255.255.0' -VServer -Session $Session\n\nAdd-NSIPResource -Type VIP  -IPAddress 172.16.124.12 -SubNetMask '255.255.255.0' -VServer -Session $Session\n```\n\nThis will add a DNS server:\n\n```powershell\nAdd-NSDnsNameServer -IPAddress 1.2.3.10\n```\n\nThe line below will enable the following features:\n- Authentication, Authorization and Auditing,\n- Load balancing,\n- Rewrite,\n- SSL offloading.\n\n```powershell\nEnable-NSFeature -Session $Session -Force -Name \"aaa\", \"lb\", \"rewrite\", \"ssl\"\n```\n\n## Setting up a reverse proxy\n\nThe above example deal with setting up the stage. However, to configure NetScaler for some\nreal work, more complex set of commands is needed. Usually, this kind of work can be abstracted \nin a PowerShell function. For instance, the following function will create a very simple reverse proxy:\n\n```powershell\nNew-ReverseProxy -IPAddress 172.16.124.12 -ExternalFQDN www.extlab.local -InternalFQDN www.lab.local\n```\n\nThe actual implementation could be:\n```powershell\nfunction New-ReverseProxy {\n    Param(\n        [String]$IPAddress,\n        [String]$ExternalFQDN,\n        [String]$InternalFQDN,\n        [String]$CertificateName = $ExternalFQDN\n    )\n    $VServerName = \"vsrv-$ExternalFQDN\"\n    $ServerName = \"srv-$InternalFQDN\"\n\n    New-NSLBServer -Name $ServerName -Domain $InternalFQDN\n    Enable-NSLBServer -Name $ServerName -Force\n    New-NSLBServiceGroup -Name svg-$ExternalFQDN -Protocol HTTP\n    New-NSLBServiceGroupMember -Name svg-$ExternalFQDN -ServerName $ServerName\n\n    New-NSLBVirtualServer -Name $VServerName -IPAddress $IPAddress -ServiceType SSL -Port 443\n    Add-NSLBVirtualServerBinding -VirtualServerName $VServerName -ServiceGroupName svg-$ExternalFQDN\n    Enable-NSLBVirtualServer -Name $VServerName -Force\n\n    Add-NSLBSSLVirtualServerCertificateBinding -Certificate $CertificateName -VirtualServerName $VServerName\n\n    New-NSRewriteAction -Name \"act-proxy-host-$InternalFQDN\" -Type Replace -Target 'HTTP.REQ.HOSTNAME' -Expression \"`\"$InternalFQDN`\"\"\n    New-NSRewritePolicy -Name \"pol-proxy-host-$InternalFQDN\" -ActionName \"act-proxy-host-$InternalFQDN\" -Rule \"true\"\n    Add-NSLBVirtualServerRewritePolicyBinding -VirtualServerName $VServerName -PolicyName \"pol-proxy-host-$InternalFQDN\" `\n        -BindPoint Request -Priority 100\n}\n```\n\n## Beyond the module\n\nAlthough, the module is still a work in progress, there are already more than 140 functions\nimplemented. Those functions cover most needs. However, you might occasionally need a Nitro\nresource that is not implemented. In that case you can rely on a simple call to `Invoke-Nitro`.\nFor instance, the following call will set the `nsroot` user's session expiration time to 1 day \n(not recommended in production but very helpful in a development environment!):\n\n```powershell\nInvoke-Nitro -Type systemuser -Method PUT -Payload @{\n        username     = \"nsroot\"\n        timeout      = \"86400\"\n        logging      = \"ENABLED\"\n        externalauth = \"ENABLED\"\n    } -Action Add -Force\n```\n\n## Examples\n\nFor a more complete example you can take a look ad [NSConfig.ps1](https://github.com/dbroeglin/windows-lab/blob/master/NSConfig.ps1)\n\n# Similar work\n\n- Carl Stalhood created [a script that configures NetScaler through Nitro](http://www.carlstalhood.com/netscaler-scripting).\n- Santiago Cardenas wrote a series of posts about [setting up NetScaler for StoreFront](https://www.citrix.com/blogs/2014/09/19/scripting-automating-netscaler-configurations-using-nitro-rest-api-and-powershell-part-1/) with load balancing and high-availability.\n- Esther Barthel has done a few [talks](https://www.citrix.com/blogs/2016/04/29/automate-netscaler-using-nitro-api-and-powershell/) about automating NetScaler configuration through Nitro.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevblackops%2Fnetscaler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevblackops%2Fnetscaler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevblackops%2Fnetscaler/lists"}