Thanks for the tip on the &output=json, that’s a bit easier but still results in the same problem. Each result is an array (in this case 2) where I have to loop through the results and form an object. Due to this format it’s simpler just to grab the computers table from sql. Alternatively I could fetch the id from api/computers but I still have to loop through each to get the details. I was wondering if there is a better query.
$uri = 'https://bigfixserver:52311/api/query?relevance=(name of it, license type of it) of bes computers'
$jBody = @{
output = “json”
}
$d = Invoke-RestMethod -Uri $uri -body $jbody -Credential $c
$o = $d.result | %{
[pscustomobject]@{
servername = $[0]
os = $[1]
}
}