So last year in the thick of Covid - a client requested a quick (and dirty) way to be able to identify endpoints outside of the UK for contractual purposes.

Using Powershell and NinjaRMM it's relatively easy to pull this together in a one liner for reporting back using custom fields

Invoke-RestMethod -Uri ('' + (Invoke-WebRequest -UseBasicParsing -Uri '').Content) | Select-Object ip, hostname, city, region, country, loc, org, postal

Alternatively - return an error code and have it trigger an alert on the NinjaRMM dashboard.

$result = Invoke-RestMethod -Uri ('' + (Invoke-WebRequest -UseBasicParsing -Uri '').Content) | Select-Object country

Ninja-Property-Set ipgeolocation $

if ($ = 'GB') {
	Write-Host '0'
	exit 0
else {
	Write-Host '999'
	exit 999

You will need to create a global custom field with the following attributes:

Then edit the field to update it to the following settings:

You can use this in a script result condition to trigger the built in alerting.