Sometimes it is desirable to move a device from one organization to another in the Automox console. This can be accomplished in two steps that can either be performed on the target device, or through the use of a Worklet if updating a large number of devices.
Manual
Manually moving a device to a new organization requires running just two commands directly on the target device.
Update Agent Key
To move a device from one organization to another, you first must update the access key the Automox agent is using to the target organization. This can be done with the help of the --setkey option.
macOS
sudo /usr/local/bin/amagent --setkey <NEW_ORGANIZATION_ACCESS_KEY>
Windows
C:\Program Files (x86)\Automox\amagent.exe --setkey <NEW_ORGANIZATION_ACCESS_KEY>
Linux
sudo /opt/amagent/amagent --setkey <NEW_ORGANIZATION_ACCESS_KEY>
Deregister the Agent
Next, you must deregister the Automox agent from the organization it is currently associated with by using the --deregister option.
macOS
sudo /usr/local/bin/amagent --deregister
Windows
C:\Program Files (x86)\Automox\amagent.exe --deregister
Linux
sudo /opt/amagent/amagent --deregister
Automatic
If you want to move a large number of devices from one organization to another, it might be preferable to create a Worklet to automatically execute the preceding steps on the target devices.
Evaluation
Because Worklets are only run when remediation is required, it is necessary to create an intentionally failing policy evaluation. This can be accomplished by returning with a non-zero exit code in the evaluation script.
macOS
#!/bin/bash
exit 1
Windows
Exit 1
Linux
#!/bin/bash
exit 1
Remediation
With a failed evaluation, the Worklet attempts to run the policy remediation steps during the scheduled policy time. Using the two steps described in the section Manual, the remediation script must first set the new organization access key and then deregister the agent from the existing organization.
macOS
#!/bin/bash
/usr/local/bin/amagent --setkey <NEW_ORGANIZATION_ACCESS_KEY>
/usr/local/bin/amagent --deregister
Windows
& "C:\Program Files (x86)\Automox\amagent.exe" --setkey <NEW_ORGANIZATION_ACCESS_KEY>
& "C:\Program Files (x86)\Automox\amagent.exe" --deregister
Linux
#!/bin/bash
/opt/amagent/amagent --setkey <NEW_ORGANIZATION_ACCESS_KEY>
/opt/amagent/amagent --deregister