PowerShell-SentinelOne
PowerShell-SentinelOne copied to clipboard
Add Decommission-Agent cmdlet
I'm looking for a way to decommission specified agents en masse where multiple agents exist on the console with the same computername but different UUIDs. The SentinelOne console currently has no way to do so with such specificity. I'm using Get-S1Agent as below to pull all agents, then filter down to offline duplicates:
$agents = get-S1Agent -APITokenName API -ResultSize All
$ht = @{}
$dupes = @()
$agents.computername | foreach {$ht["$_"] += 1}
$ht.keys | where {$ht["$_"] -gt 1} | foreach {$dupes += $_ }
$offlineDupes = $agents | where {$_.computername -in $dupes -and $_.IsActive -eq "false"}
Could a cmdlet be added to access the "/web/api/v2.1/agents/actions/decommission" endpoint and decommission agents?