Powershell API - Get List of Computers

edited August 2022 in Enterprise Security

I am trying to use the Control Center API to get a list of computers from GravityZone. I've got all the basics working. I generated the API key and I am able to authenticate and query data. Now I am trying to use the code at the bottom of this message to get my computers from Active Directory. No matter what I do, it seems to return results from the "Computers and Groups" group in the hierarchy (indicated by the green arrow in this screensnip). I'm trying to get the computers from one of my Active Directory domains instead (indicated with the red arrow). I used the getCustomGroupsList method to start at the top of the hierarchy and descend down to Active Directory until I see the Name and ID of the AD domain I'm interested in. When I pass that ID into the code at bottom, it's still giving me results from the Computers and Groups group. If I leave the ParentID parameter off, it also returns results from Computers and Groups. (For brevity, I left out the code that uses the API Key to generate the Auth header ($auth_header), but I know that's working since I'm able to get results from my queries.)

------------------------------------ Begin Powershell Code ------------------------------------

$page = 1

$pagesCount = 999999

$Workstations = @()

While ($page -le $pagesCount) {

# Create the query. This will be executed one page a time.

$request_data = '{




"parentID": "ABCDEFGHI123456", # The ID returned from getCustomGroupsList

"filters": {

"type": {

"computers": true,

"vitualMachines": true


"depth": {

"allItemsRecursively": false


"options": {

"companies": {

"returnAllProducts": true



"security": {

"management": {

"managedWithBest": true,

"managedRelays": true






"page":' + $page + ',




# Generate the API call parameters

$params = @{

Uri     = $request_uri

Headers   = @{

'Authorization' = "$authheader"

'Content-Type' = "application/json"


Method   = 'POST'

Body    = $request_data

ContentType = 'application/json'


# Call the API endpoint

$response = Invoke-RestMethod @params

# If we get an error, spit it out and end the loop

If ($response.error) {


exit 9

# If we get results, add them to the result set.

} Else {

$Workstations += $response.result.items

$pagesCount = $response.result.pagesCount




# Dump out the results


------------------------------------ End Powershell Code ------------------------------------


  • Gjoksi
    Gjoksi Defender of the year 2022 ✭✭✭✭✭


    Since you need help with business product, @Alex_Dr could take a look here and help you.

    Also, you can always contact the Bitdefender business support:



  • Alex_Dr
    Alex_Dr Quality & Customer Experience Specialist BD Staff

    Hello @jeff.pyne,

    I do apologize for my late reply as i was asking for advice from the team that handles API information, documentation and other API related queries. They suggested you use this link for additional API-related inquiries and, for your specific situation, use getNetworkInventoryItems.

    Do let me know how it works out for you and if additional assistance is required.

    Alex D.