Bulk Device Rename

R
Robin
Koerber Supply Chain AU Pty Ltd

Hi,

We've just recently provisioned another large quantity of Android Enterprise devices into SOTI and our current preference is that the devices are named in the console with the companies asset ID.

Normally we'd have to go through and manually use the scripting command to send the 'devrename' command with the new name to each device individually, however this is time consuming and very labour intensive to do for large quantities.

Is there a way to send a bulk script to update these?  Currently these devices are enrolled with their serial number as their name, so the script would contain device serial and new name as a mapping.

Does anyone know if this is possible?

Cheers! 

Edited 4 years ago
Android Scripting
ANSWERS
RC
Raymond Chan Diamond Contributor
4 years ago (edited 4 years ago)

What are the version and build numbers of your MobiControl server and of the device agent(s) on the devices to be renamed?

Approximately how many AE devices need to be renamed to use Company Asset ID?  Are they in a "complex" tree(s) of device groups in which some other devices were named/renaming with pattern(s) DIFFERENT from "Company Asset ID"?  How many device groups  are there in each such device-group tree(s)/sub-tree(s)?

Do you/your team has any programming experience with MobiControl API? What about with javascript script engine supported by some recent MobiControl device agent (s)?

R
Robin
4 years ago

Hi Raymond,

Thanks for the response.

The current version of our server instance is 14.5.2.1086.

The agent on the devices is 14.4.1.1064 and they're all AE enrolled.

There are around 150 or so devices in this batch, however there will be more batches to follow which will require the same treatment.  All of the devices are in a single group for now that we use for 'staging'.  They'll get moved to their respective OU's as soon as they've been tested and re-named.

Currently we don't have any experience with teh Mobicontrol API, however if you think this will achieve the result we're happy to look at it.

Cheers,

Rob

RC
Raymond Chan Diamond Contributor
4 years ago (edited 4 years ago)

Hi Robin,

Since your side have no experience in programming using MobiControl API, and ALL your 150 or so devices are in one particular device group,  the simplest approach for you is probably to  use script with custom attribute at the device-group level as follows:

(1)  Add a new custom attribute, say "NewDeviceName" of type TEXT STRING.

(2)  In your web console, select your device group, select to view a maximum of 250 device on a page, and customize the column view to show Device ID and Device name.  Then export the device list by choosing the "Download CSV" menu item.  This file with all the Device-ID's  can be saved as a template for other uses  in the future.

(3) Edit the exported CSV file such that each line includes something like

           Device_ID_exported, NewDeviceName,  your_desired_new_device_name

In short, the first field needs not be changed. Add a second field for the custom-attribute "NewDeviceName", and replace the last field (the original device name exported) to be the desired new name.

(4) Click the menu associated with "View All Devices" and select "Import Custom Attributes".  Use the file prepared in step (3). Confirm that the custom attribute NewDeviceName of each referenced device is set with the desired device name accordingly.

(5) Perform an "Execute Action -> Send Script" to the whole device group with the legacy script

          devrename %CustomAttr:NewDeviceName%

 

R
Robin
4 years ago

Hi Raymond,

Thanks so much for your solution.  One question though, the custom attribute field - isn't this viewable in the device detail screen?  I can't seem to find it at all...

RC
Raymond Chan Diamond Contributor
4 years ago (edited 4 years ago)

Have you added any custom attribute yet?

Their values can be viewed in both a customized columns in the device list view or in the Device-Details view.

 

R
Robin
4 years ago

Hi Raymond,

It's weird as the console was not displaying the attributes in the device details page.  I've re-checked it just now and it's now there...?   Maybe there was a delay in the console showing this new attribute.

Apologies for wasting your time!

RC
Raymond Chan Diamond Contributor
4 years ago

You mght need to refresh the Device-Details view, or even to force a sync/update of MobiControl Search  database in the Global Settings in order to see newly added items.

R
Robin
4 years ago

Hi Raymond,

I've run into issues with this script again - it's not applying the custom attribute from the device detail.  The devices in question clearly have this attribute set, however when i run the script either indivitually or on the entire group (devrename %CustomAttr:NewDeviceName%) it does not update the name.

Any ideas what would cause this?

RC
Raymond Chan Diamond Contributor
4 years ago

Did you select "javascript" rather than "legacy script" when performing the "send script" action?  Did you check whether you can successfully renaming a device with any standard macro such as

    devrename %IMEI%

I reconfirmed the approach to be working fine a moment ago on a MobiControl v14.5.5 test instance.    In the past, I encountered a small number of MobiControl server releases in which custom-attribute related functions fail.  What are the version and build numbers of your MobiControl server and agent?

R
Robin
4 years ago

Hi Raymond,

The server version is 14.5.2.1086.  The agent on the devices is 14.4.1.1064, however i've also tested it with a more recent version 14.5.3.1017.

The frustrating part is that a "devrename %IMEI%" command works fine.

I do recall this working the other day for a single device whilst testing (devrename %CustomAttr:NewDeviceName%), however have gone to update the remaining this morning and cannot get them to rename on mass, or indiviually.

I wasn't using "javascript" option in scripting, as i don't believe our console supports this method, only the legacy option.

Any other suggestions to try?

RC
Raymond Chan Diamond Contributor
4 years ago (edited 4 years ago)

Make sure you test  with an ONLINE device you have on hand to confirm if the approach works on your server version.   Also make sure your custom attribute has the option "Propagate to Device" enabled.

If you have send-script action initated for a test device-group, do ALL devices in that targeted group fail? Or some gets renamed while some not?

Please note that the target devices need to get connected to the server before the script can be run and device renamed.  So, when  deploying to production group(s),  devices not on-line yet will not be renamed.  The script may only be buffered by your server for an unknown period of time, and some devices offline for too long may not have the script sent.  One workaround is to add the script as a pre-script of a new file-sync rule with option to sync when device connects. to the server. With this, the server will do/redo the renaming task whenever devices connect to the server, and you can disable the rule only after all devices have been renamed.

R
Robin
4 years ago

Hi Raymond,

All of the devices in question are on hand which does make this convenient.  They've been staged, ready to be boxed and deployed.

All of the devices i've tested this on - is with an online agent.  I can run a devrename command to them manually and specify any other values, it just won't set it based on %CustomAttr:NewDeviceName%

All of the devices fail, whether done individually or attempted in bulk.

The send to devices option wasn't set in the global config, which i've now corrected.

I've attempted this again a few times and still having no luck!

Only 1 device has been successful in all my attempts and i can't work out why it was so...