PowerShell as the REST API Client

Use the following script to test communication to the array using the PowerShell as the Windows-based REST API client:

###########################
# Enable HTTPS
########################### 

[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}
 
###########################
# Get Token
###########################

$array = "myarray.domain.com"
$username = "MyUsername"
$password = "MyPassword" 

$data = @{
    username = $username       
    password = $password
} 

$body = convertto-json (@{ data = $data }) 

$uri = "https://" + $array + ":5392/v1/tokens"
$token = Invoke-RestMethod -Uri $uri -Method Post -Body $body
$token = $token.data.session_token 

###########################
# Print Results
########################### 

$token 

Expected output is a session token, similar to :7f39888e5b9ba094f4f3103fb3f923b2
NOTE: Your token value will be different than the one shown for this example.