I need to create custom names for Android Zebra devices.

I would like to be able to rename Android Zebra TC devices that have been relocated to particular groups based on IP subnet rules. I need the new device name to contain 3 variables. Group name (ex. VAMAR3), the device type (this will always be RF for our organization), and the last 6 characters for the network assigned hostname.

I am able to rename the devices to the complete %HOSTNAME% macro (android-6458060d3fff70bb.xxxxx.net in this case), but I have not been able to find a way to select the 6 last characters or set the rest of the variables needed.

The complete name on this example would be VAMAR3RFff70bb. Again, I want to do this for each device when they get relocated based on the IP.

Any assistance would be appreciated.

a year ago
Android Scripting
ANSWERS
RC
Raymond Chan Diamond Contributor
a year ago

David,

You can consider using Monbicontrol javascript for Android devices.  But results vary with device model, firmware  & agent versions, so you have to do tests on your own device to see if various components work or not.

1. Check if   mobicontrol.network.IpAddress.hostName  can return your desired device hostname.  According to the reference manual, IP address will be returned if hostname cannot be.

2. Check if  mobicontrol.agent.getCustomAttribute() function can return custom attribute value,  which in your case maybe is the name of the "device group" created by you for each device group of interest

3. Check if  mobicontrol.device.renameTo() function can rename your device.  (N.B.  I found it not very stable on some of my test devices]

If all of the above are positive, then the following standard javascript functions can be used to extract desired substring (e.g. from your hostname variable) before concatenating various parts to finally rename the device:

  indexOf()

  substr()

  MyString.length       

C
CKMOD@SOTI
a year ago

Hi David,
 
Thanks for posting on SOTI Pulse, Thanks Raymond
for responding to the post, your expertise and willingness to help are greatly appreciated!
 
Have you had an opportunity to test the suggested solutions by Raymond and has it successfully addressed your query?
 
If not, or If you have any additional questions or concerns, please don't hesitate to reach out. We're dedicated to providing assistance and support.