Rename a device with %AUTONUM%

K
Kristine
DHL Supply Chain Management GmbH

Hi everyone,

I found this scrip that renames a device -- devrename -- and tested it with multiple attributes.

It works with %SERIALNUM% or %MODEL% etc but not with %AUTONUM%

In the Add device rule, the device name can be set upon enrollment of the device based on combination of these attributes. The %AUTONUM% works in the rule but not on the rename script.

Is there a way the %AUTONUM% can be used in renaming a device? My plan is to move the device from a staging folder to a specific folder, run the script to rename the device but it needs to set the AUTONUM so it will increment from the last number.

TEST%MODEL%%AUTONUM% == TESTTC5700886 --> expected result

Thank you in advance.

Edited 4 years ago
SOTI MobiControl
ANSWERS
RC
Raymond Chan Diamond Contributor
4 years ago

For EACH add-devices rule, there is an internal counter to track the number of device previously enrolled successfully or unsuccessfully so that the macro %AUTONUM% can be used to give a different device name for that particular add-device rule, and nor for a particular device group.

However, this %AUTONUM% macro does not make any sense when used in script because there is no UNIQUE counter that can be referenced for devices enrolled possibly with two or more add-devices rules at different times in the past.

If you have a lot of devices to move and rename, one possible way to automate the task with some kind of auto-numbering is probably to use MobiControl REST API's.

K
Kristine
4 years ago

Hi Raymond,

Thank you very much for your answer. The counter makes a lot of sense.

Could you please let me know what property should be used then to manage it with the API?

Thanks.

RC
Raymond Chan Diamond Contributor
4 years ago

There are MobiControl API calls to get name of all devices in a specific device group and to rename a specific device.  So, based on your own corporate requirements (e.g. work flow, organization structure, naming pattern, etc.), you can check what are the maximum suffix number for devices within a device group and always rename a newly relocated device to have suffix of value 1 higher than the current found maximum.

M
MartinsKl
4 years ago (edited 4 years ago)

Do you need to rename a lot of devices or want to rename every time you enroll a new one?
If every time a new one, you would have to make a script, that exports all devices, compares for example last digits, then adds +1 and renames next device. You would need 2 locations for renamed and still to be renamed devices and in the end of the script they would need to be moved to new location. Also not to mix up you would have to run this script from server every time to rename a device ( in api probably take 1, rename, move). Also would have to solve and issue what happens if there is 1 device missing from the middle.

To open server, run script, get api user and pass from secure location, process it, it would probably take more time than just filtering by name, checking last one and rename by hand.
I would suggest using mac or serial number in that case and if they call for support, just ask last 6 digits or so.

K
Kristine
4 years ago

Thank you. We're still looking into the API and how we can use it.

Thanks for your inputs.