Add-Type -AssemblyName PresentationFramework $global:fqdn = "" $global:token = '' $global:response = " " $timestamp = Get-Date -Format o | ForEach-Object { $_ -replace ":", "." } $report=".\data\TestTargets.txt" function Get-Tests { # Param ( # [Parameter(Mandatory)] [ValidateSet('name', 'connector', 'description')] [string] $orderBy, # [Parameter(Mandatory)] [ValidateSet('continuousTest', 'loadTest', 'applicationTest')] [string] $testType, # [Parameter(Mandatory)] [ValidateSet('ascending', 'descending')] [string] $direction, # [Parameter(Mandatory)] [ValidateSet('environment', 'workload', 'thresholds', 'all')] [string] $include, # [Parameter(Mandatory)] [string]$count # ) # this is only required for older version of PowerShell/.NET [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 -bor [Net.SecurityProtocolType]::Tls11 # WARNING: ignoring SSL/TLS certificate errors is a security risk [System.Net.ServicePointManager]::ServerCertificateValidationCallback = [SSLHandler]::GetSSLHandler() $Header = @{ "Accept" = "application/json" "Authorization" = "Bearer $global:token" } $Body = @{ # testType = $testType orderBy = "name" direction = "asc" count = 1000 include = "connectionResources" } $Parameters = @{ Uri = 'https://' + $global:fqdn + '/publicApi/v7-preview/tests' Headers = $Header Method = 'GET' body = $Body ContentType = 'application/json' } $Response = Invoke-RestMethod @Parameters $Response.items } "Test Name,Target" | Out-File $report -Force -Encoding utf8 $tests = Get-Tests ForEach ($test in $tests) { $test.name + "," + $test.connectionResources.connector.hostlist.endpoint | Out-File $report -Append -Force -Encoding utf8 }