I created a simple function to execute get commands against the REST services in cortex in powershell. 


The function below will execute an http get command from any cortex URL 


function Execute-HTTPGetCommand()



[string]$target = $null


$username = "user"

$password = "pw"

$webRequest = [System.Net.WebRequest]::Create($target)

$webRequest.ServicePoint.Expect100Continue = $false

$webRequest.Credentials = New-Object System.Net.NetworkCredential -ArgumentList $username, $password 

$webRequest.PreAuthenticate = $true

$webRequest.Method = "Get"

    [System.Net.WebResponse]$resp = $webRequest.GetResponse();

    $rs = $resp.GetResponseStream();

    [System.IO.StreamReader]$sr = New-Object System.IO.StreamReader -argumentList $rs;

    [string]$results = $sr.ReadToEnd();

    return $results;



The code below shows the function in use against the /arrays page


[xml]$Array_Result = Execute-HTTPGetCommand ""



The result of the 'get' is stored in $Array_Result in XML format.  For example; if you want to pull the array name and place it in a seperate variable it would look like this:


$Array_ID = $Array_Result.arrays.array.name