Skip to main content

When comparing Automox to competitor products, one feature I found lacking was the ability to apply policies based on device manufacturer. As many admins are already aware, Dell specifically has had a couple zero days released in recent months.



This worklet is a slight modification of the code posted by JHagstrom, and simply adds the device manufacturer as a tag so it can be targeted.



One thing I haven’t figured out is how to add the tag without removing existing tags. Be aware that this will delete any existing tags on the device.



Function Invoke-AutomoxAPI{

>cmdletbinding()]

Param()



$apiKey = "INSERT API KEY HERE"

$apiUrl = "https://console.automox.com/api/servers/"

$headers = New-Object "System.Collections.Generic.DictionaryryString],]String]]"

$headers.Add("Authorization", "Bearer $apiKey")



#Get all devices in the org to parse

$response = Invoke-RestMethod $apiUrl -Method 'GET' -Headers $headers -Body $body

$response | ConvertTo-Json

$currentMachineName = $env:COMPUTERNAME;

#Perform loop to figure out what our deviceID is and populate variables

foreach($server in $response){

$name = $server.name;

if($currentMachineName -eq $name){

$id = $server.id

$organization_id = $server.organization_id

$server_group_id = $server.server_group_id



#Modify device through API

## Now calling modify device API and set Manufacturer in tags

$headers.Add("Content-Type", "application/json")

$apiUrl = "https://console.automox.com/api/servers/$($id)?o=$($organization_id)"

$body = "{

`"server_group_id`": $server_group_id,

`"tags`": :

`"$man`"

]

}"

$body

$response = Invoke-RestMethod $apiUrl -Method 'PUT' -Headers $headers -Body $body

$response | ConvertTo-Json

}

}

}

# Get device manufacturer, save into variable, and push to Automox

try {

$man = (Get-WmiObject win32_computersystem).Manufacturer

Invoke-AutomoxAPI

} catch {

Write-Output "Error"

}

A post was merged into an existing topic: Worklet: Install BitLocker and store keys in device tag


Reply