Good morning @Karl_Hart !
While migrating a device to another zone can be scripted via Powershell, it goes against our best practices to use this method via a Worklet as there is a high chance that it will result in a dead agent and/or a stuck command. We recommend manually issuing the --setkey
command to the device to change zones:
https://help.automox.com/hc/en-us/articles/5352231166612-Moving-Devices-From-One-Zone-to-Another
If you wanted to perform this via Powershell, you can use the following script:
$newZoneKey = ""
$amagentPath = "C:\Program Files (x86)\Automox\amagent.exe"
Start-Process $amagentPath -ArgumentList ("--setkey $newZoneKey")
Start-Process $amagentPath -ArgumentList ("--deregister")
Stop-Service -Name amagent -Force
Start-Sleep 10
Start-Service -Name amagent
Again, this is not a method that should be executed via a Worklet, but instead issued to the device locally or through another RMM.
I hope this helps. Have a great day!