@wperry1 I ran into the same issue. The two options I came up were 1. What you are doing by moving the device(s) to a new network. 2. Tie access to x,y,z to tags and then as apart of your termination script loop through the tags and delete all of them. Below is an example of that I used in python. This way all the access was removed but the device was still managed. You can play with the hostname variable too so that they show up something like `Termed-useraccount`.
def get_all_tags ():
url = "https://api.meraki.com/api/v0/networks/%s/sm/devices" % network_id
querystring = {
"serials": serial_number
}
payload = ""
try:
r = requests.request("GET", url, data=payload, headers=meraki_headers, params=querystring)
r.raise_for_status()
except requests.exceptions.HTTPError as err:
print (err)
sys.exit(1)
machine_info = r.json()
global users_machine_id, machine_tags
users_machine_id = machine_info['devices'][0]['id']
machine_tags = machine_info['devices'][0]['tags']
def update_meraki_hostname ():
print ("Attempting to update hostname in Meraki.")
headers = {
'X-Cisco-Meraki-API-Key': meraki_api_key,
'Content-Type': "application/json",
}
data = {"serials":serial_number,
"deviceFields":
{"name":host_name}
}
requests.put('https://api.meraki.com/api/v0/networks/%s/sm/device/fields', headers=headers, data=data) % network_id
def meraki_tag (action, ttype):
url = "https://api.meraki.com/api/v0/networks/%s/sm/devices" % network_id
args = {
"updateAction":action,
"tags": ttype,
"serials":serial_number}
payload = ""
headers = {
'X-Cisco-Meraki-API-Key': meraki_api_key,
'Content-Type': "application/json",
'cache-control': "no-cache",
}
try:
r = requests.request("PUT", url, data=payload, headers=headers, params=args)
r.raise_for_status()
except requests.exceptions.HTTPError as err:
print (err)
def meraki_tag_loop ():
for t in machine_tags:
meraki_tag ('delete', t)