Skip to content

Instantly share code, notes, and snippets.

@ryancbutler
Last active March 7, 2017 18:12
Show Gist options
  • Save ryancbutler/011ceab59397abd6feb977776936aa93 to your computer and use it in GitHub Desktop.
Save ryancbutler/011ceab59397abd6feb977776936aa93 to your computer and use it in GitHub Desktop.
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}
$username = "nsroot"
$password = "nsroot"
$nsip = "https://192.168.1.50"
$body = ConvertTo-JSON @{
"login"=@{
"username"="$username";
"password"="$password"
}
}
Invoke-RestMethod -uri "$nsip/nitro/v1/config/login" -body $body -SessionVariable NSSession -Headers @{"Content-Type"="application/vnd.com.citrix.netscaler.login+json"} -Method POST
$ssl = Invoke-RestMethod -uri "$nsip/nitro/v1/config/sslcertkey" -WebSession $NSSession -Headers @{"Content-Type"="application/json"} -Method GET
$ssl.sslcertkey|select certkey,cert,key|ft -AutoSize
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment