Delete device by manufacturer

I have removed all devices from a specific manufacturer from my network.
Can I mass delete all of the devices from that manufacturer from genieacs?

Thank you.

There is no built-in way to accomplish this. However, if you have PHP installed you can modify and run this script to accomplish your goal.

<?php

$nbi = 'https://your_ip:7557';

$filter = [
    'InternetGatewayDevice.DeviceInfo.Manufacturer' => 'Comtrend'
];

$devices = queryNbi($nbi, $filter);
$count = count($devices);

printf("Deleting %d devices\r\n", $count);

foreach ($devices as $id) {
    $uri = sprintf('%s/devices/%s', $nbi, rawurlencode($id));

    if (!deleteDevice($uri)) {
        print("Error deleting device ${id}\r\n");
    }
}

printf("Deleted %d devices\r\n\r\n", $count);

function deleteDevice(string $uri): bool {
    print("${uri}\r\n");

    $curl = createCurl($uri);

    curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'DELETE');
    curl_exec($curl);

    $statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
    
    return $statusCode === 200;
}

function queryNbi(string $nbi, array $filter) {
    $projections = ['_id'];

    $projection = $projections ? implode(',', $projections) : null;

    $uri = sprintf('%s/devices/?query=%s&projection=%s', $nbi, rawurlencode(json_encode($filter)), $projection);

    $curl = createCurl($uri);

    $data = json_decode(curl_exec($curl), true);

    curl_close($curl);

    return array_map(function ($row) {
        return $row['_id'];
    }, $data);
}

function createCurl(string $url) {
    $curl = curl_init();

    curl_setopt($curl, CURLOPT_TIMEOUT_MS, 20000);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, true);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

    curl_setopt($curl, CURLOPT_URL, $url);

    return $curl;
}