Admin By Request (ABR) assigns a license to every device the agent is installed on, and releases licenses automatically when a device stops reporting. Most of the time there is nothing to think about. But when an MSP or an organization gets close to its seat cap, a real question comes up: which stale devices are safe to remove to free a seat, without touching a machine that is still in use?
As a Microsoft 365 security integrator and ABR partner, OnCloud manages a lot of ABR tenants. We built a single read-only PowerShell script that solves exactly this: it reads license usage from the tenant, and only when a seat pool is close to its cap does it free just enough seats — by removing the oldest devices confirmed to be genuinely offline. By default it only reports, and deletes nothing.
Why not just delete everything that looks old
ABR already removes inactive devices after about 60 days, so deleting for tidiness is pointless. And the last inventory date on its own is a misleading signal: sometimes the agent is alive and reporting activity, it just has not pushed a full inventory sync. A laptop that was powered off for two weeks looks old — but you must not delete it, because the moment it comes back it simply re-registers and takes a seat again.
So the tool does not rely on the inventory date alone. For every deletion candidate it cross-checks two more signals — that device Events and Audit log — and deletes only when all three are quiet. Any recent activity in either, or even an error during the check, keeps the device.
What the tool does
- Reads license usage from the tenant — workstation and server seats, actual usage and expiry — straight from the API.
- Acts only over the threshold. The default is 85% usage. Below it, the tool prints the license status and stops, touching nothing.
- Frees only as needed. When a pool is over, it frees exactly the number of seats required to get back under the threshold, oldest device first — no more.
- Cross-checks every candidate against its Events and Audit log. One signal of activity (or a check error) keeps the device.
- Separates workstation from server. A full workstation pool never deletes a server device, and the other way round.
- Read-only by default. Deletion happens only with
-Delete, with per-device confirmation and a max-delete cap that prevents mistakes.
Bonus — a license check in its own right: on every run the tool prints each pool usage against its cap and the days remaining until expiry, and warns when a license is about to lapse. You can run it periodically just for that, even when there is nothing to delete.
Run it
Run the script from an admin machine, not from the endpoint. Pass the tenant API key through an environment variable so it stays out of your command history:
$env:ABR_API_KEY = '<tenant-api-key>'; .\ABR-Seat-Reclaim.ps1That is a read-only run: it prints the license status and, if any pool is over the threshold, what *would* be freed. Nothing is deleted. To actually free seats, add -Delete (and you can change the threshold):
.\ABR-Seat-Reclaim.ps1 -ThresholdPercent 90 -DeleteDeletion runs oldest device first, with per-device confirmation and up to a max-delete cap that guards against an accidental bulk wipe.
Sample output
=== Admin By Request - License Seat Reclaim ===
Reclaim threshold: 85% Staleness: 30 days
Tenant: Contoso
License status:
Workstation 47/50 ( 94%) expires 2027-08-04 (245 days) <= OVER THRESHOLD
Server 3/25 ( 12%) expires 2027-08-04 (245 days)
Pool 'Workstation': need to free 5 seat(s) to get under 85%.
checking OLD-LAPTOP-07 (last inventory: 2026-09-20)
checking SPARE-VM-02 (last inventory: 2026-09-28)
=== Reclaim plan ===
Seats to free : 5
Confirmed reclaimable : 5
Dry run complete. Re-run with -Delete to free these seats.Why it matters
Licenses cost money, and a seat held by a dead machine is a quiet waste. On the other side, a blanket delete by last-seen date can remove a device that was merely powered off. The tool is the middle path: free exactly what you need, only when you need it, and only after checking — through the Events and Audit log — that the device is really gone.
Want to reclaim license seats safely on your own tenant? Download the read-only tool.
Get it on GitHub