Quantcast
Viewing all articles
Browse latest Browse all 1891

Remove duplicate items in computer object returned from SEPM API query

When getting computer status info by domain from API using PowerShell I had to break this down into a 4 stage process

First I get the domains info if I first request all the domains using:  $URI = $BaseURI+"/domains"

 

Then I use each domain.id returned and use the following API call: $URI = $BaseURI+"/groups?domain="+$DomainID

 

Then I use each returned group.id to form the following API call: $URI = $BaseURI+"/groups/$GroupID/computers?domain="+$DomainID

 

That last API call returns the computer data broken down by group in each domain

*****but *****

then I have to do a transform on the JSON data returned as it has 9 items with the same data and name but different capitalization, which would be fine if I was using Python or a case sensitive programming language as it would just ignore the duplicates.

 

The duplicate properties are as follows:

"osBitness"

"osbitness"

"osFlavorNumber"

"osflavorNumber"

"osFunction"

"osfunction"

"osLanguage"

"oslanguage"

"osMajor"

"osmajor"

"osMinor"

"osminor"

"osName"

"osname"

"osServicePack"

"osservicePack"

"osVersion"

"osversion"

 

Once I do that I can access the data by domain in a way that PowerShell will understand it as JSON objects. (case insensitive)

Request: remove the 9 duplicate item properties with improper Camel case


Viewing all articles
Browse latest Browse all 1891

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>