Issues with Custom Attributes not Renaming Devices

E
Edvin
IDNet AB

Hello,

I need to rename several devices and have seen that this should be possible through CA. I want to use the macro %AUTONUM%.

CA has been followed as per following links:  https://discussions.soti.net/articles/000002293 and https://discussions.soti.net/thread/bulk-device-rename

I have created a CSV file with the correct content, and the CA is populated at Device Details, which is also visible there.

The problem is that the device is named exactly "Model Name %AUTONUM%", that is, the macro does not work correctly.

I've also seen that you can send a script (included in the previously referenced links), but it makes no difference.

Should this work or not?

a year ago
SOTI MobiControl
ANSWERS
RK
Radim Kadlec
a year ago
  1. Create a Text Custom Attribute (YourAttributeName) that is assigned to "Send to device".
  2. Give this attribute appropriate values for your devices (you can use the .csv import function if needed).
  3. Use legacy script devrename ModelName_%CustomAttr:YourAttributeName%

As far as I know %AUTONUM% is only available during the device enrollment.

Yes, the autonum macro is not working on regular scripts but you can use javascript (mobicontrol.device.renameTo('YourDeviceName');) or legacy script (devrename "YourDeviceName") to rename the devices.

Custom attributes can be also accessed via both legacy (%CustomAttr:YourAttributeName%) and javascript (mobicontrol.agent.getCustomAttribute("myCustomKeyName").

RC
Raymond Chan Diamond Contributor
a year ago

%AUTONUM% is used by MobiControl server itself for device enrollment and related tasks only.  The auto-incrementation is done in real-time on each task request, irrespective of whether the task is eventually successfully completed or not.  Hence, using it in device enrollment can create gaps in the naming if some enrollment attempts fail, for example due to poor connection signal level.

In your case of renaming with script, if you have several devices whose names should have some kind of sequence number, then it is better to set the required UNIQUE sequence number in the value of your existing/new custom attribute, and then refer to the macro of such custom attribute for renaming in your script to avoid any gap or undesired assignment.

Another possibility would be (for newly enrolled devices) if you use the autonum macro in the enrollment rule, grab this number, write it into an ini or xml file on the device being read by Soti agent and then reuse it for the new renaming. All done via an assigned javascript task to be runned once.

But for existing devices this would mean you need create such ini file "manually" via script (if they are already named with such a number manually, i think you can do in general the same.

And this would also mean you need to use custom data instead of custom attribute.

T
TLMOD@SOTI
a year ago

Hi Edvin,


Thanks for posting on SOTI pulse. Thanks Radim, Raymond and Rafael for responding to the post, your expertise and willingness to help are greatly appreciated!


Has your query been resolved? If not, or if you have any additional concerns, please don't hesitate to reach out. We are dedicated to providing assistance and support.


Also, if this post has helped you in solving your query, I would request you to mark the particular comment as "is solution", so that others may benefit from this information.


Kind Regards,