JavaScript "installSystemUpdate(systemUpdateFile)" how to use in script.

C
Chris
MAN Truck & Bus SE

I have tested this command but it did not work.

How is the correct syntax for this command?

Thank you for your help

3 years ago
Android Scripting
ANSWERS
RC
Raymond Chan Diamond Contributor
3 years ago

What are the version and build numbers of MobiControl server and device agent are you using?

What about the brand and model of the device you are working on?   Did you get the system update file from some official site of the OEM device support site?   Please note the following risks if you perform update with this approach:

1.  Your device might fail to boot if the update operation cannot be completed in full, and your official device warranty  may become void if you perform upgrade using mechanism other than official mechanism initiated via Settings app in your device firmware.  The device support/service centre may thus refuse to fix your bricked device.   Hence, it might be better if you have the technical knowhow to perform various operations via your device ADB/JTAG port just in case something goes terribly wrong.

2.  Your device might fail to operate reliably/securely if you use the wrong update image, or if the update image is not a clean malware-free official copy.

I personally have not tried using this command to do update on any test device.   So I don't know if the script command works or not.    

I don't know exactly what you used in your script for your failed trial.   Did you create a file before calling  installSystemUpdate().   For the correct syntaxes of related commands, you can reference the latest online document at 

   https://www.soti.net/mc/help/javascriptapi/en/mobicontrol.os.html

   https://www.soti.net/mc/help/javascriptapi/en/mobicontrol.io.File.html

C
Chris
3 years ago

Hello,

we use SOTI Version: 15.5.1.1010 and Agent Version 15.2.1.1058.

We have developed an automatic staging procedure whereby all our new devices (Zebra) are automatically supplied with the agents / firmware / patches that we have released / tested. This staging process has been running stable and reliable for more than 4 years. The only problem we have had since our update to version 15 is that in the legacy scripts the disconnect / reconnect -f command is not always executed cleanly. On our test system this never worked and we replaced the two commands with a reset. On our production system, the legacy scripts have always worked until now. Unfortunately, there have been problems there as well in the last few days. After consultation with our SOTI TAM we agreed to reproduce the whole thing now with JavaSript. The only thing that does not work with JavaScript is the command mobicontrol.os.installSystemUpdate(updatefile).

All our devices have a 5 year maintenance contract with Zebra, so we are able to download the updates directly there.We have the problem with the wrong firmware for the wrong device under control.

I know the SOTI javaScript documentation, but it is not very helpful in this case and some other cases.

MFG

RC
Raymond Chan Diamond Contributor
3 years ago

Zebra provides good management utilities/framework (e.g. MX) for managing their devices, so you should use them for important operations such as device firmware upgrade.

MobiControl legacy script has support for calling Zebra MX, and can be considered a safe approach for initiating firmware upgrade on Zebra devices.    For the more recent Javascript engine within Android device agent,  I am not sure if calling installSystemUpdate()  will use Zebra MX if the target device is from Zebra.  Unless I can confirm officially with Soti that this is the case,  I personally will not use this javascript mechanism to initiate a firmware upgrade.

C
Chris
3 years ago

Hello,

is the command "mobicontrol.os.installSystemUpdate(file);" not the same as the legay command "install_system_update"?

Why creates SOTI those commands if they do not work and I have to use the tools from the device manufacture?

Our goal is to solve everything with the possibilities of SOTI MobiControl to be prepared for the future. Because in the future we might not only use Zebra devices but also devices from other manufacturers. Since we have to serve several locations all over the world and not every location has enough technicians to deal with every tool of the different manufacturers. Therefore, we use SOTI as a central management system to have all devices in the same state at all locations.

How works this command now? What requirements must the devices meet in order to use this command?

MD
Matt Dermody Diamond Contributor
3 years ago

It is not necessarily reasonable to expect that the particular script is going to be universally applicable to all device manufacturers as every manufacturer provides OS updates and a mechanism for applying them in a slightly different manner. For example Honeywell and Zebra both provide access to firmware update files but they are applied and processed differently on devices and would therefore require different scripting in order to execute the update. Other manufacturers like Samsung may not provide a firmware update file at all and would expect you to leverage OTA updates. Note that Zebra also has a LifeGuard OTA program as an alternate means of installing the firmware updates on the devices as opposed to the historical Zip file download + script mechanism that you've been employing.

I manage over 100 different SOTI MobiControl environments containing Zebra devices and I am still consistently using the legacy install_system_update script in almost every one of them. If you are looking to reproduce the reconnect scripting I would recommend the sleep script command instead. You can insert a sleep script of 10-20 seconds to execute before the install_system_update script in order to give the device enough time to ensure that the Zip file has been fully downloaded. I don't have any experience using the javascript based approach so I do not have any advice there, but I also do not think you need to be using the javascript option necessarily either as install_system_update should still be working.

If not install_system_update you can also attempt to use mxconfig scripting on a StageNow generated MX XML file designed for performing the upgrade as an alternative. I have found this mechanism is often required for the newer OS versions on the Zebra devices, and especially so if you ever need to perform a downgrade. 

K
KCMOD@SOTI Silver Contributor
3 years ago

Hello Chris,

Thank you for posting on SOTI Central!

Does Raymond's and Matt's replies helped to answer your question?

If yes, please mark this post as solutioned.
Please let us know if you have any other questions.

Regards,

Technical Support | SOTI Inc. |1.905.624.9828 | support@soti.net | www.soti.net |

C
Chris
3 years ago

Hello,

so far I have not received an answer on how to use the command and what requirements must be filled for the command to work.

K
KCMOD@SOTI Silver Contributor
3 years ago

Hello Chris,

Thank you for posting on SOTI Central!

As you are entitled for an enterprise support, your TAM/aligned engineer will reach out to you to assist you further with this issue as it is requires deeper analysis and troubleshooting.

If you'd like, please feel free to reach out to your TAM or aligned engineer directly as well. They are aware of this post and will be happy to assist you further.

Regards,

Technical Support | SOTI Inc. |1.905.624.9828 | support@soti.net | www.soti.net |

PI
Patrick I.
3 years ago

Hello Chris,
did you find out how to get it working in the meanwhile?

I'm trying to configure a File Sync Rule that enables the user to postpone a system update on Zebra MC3300x devices running Android Plus.

After file synchronisation the following script is executed:

#!/usr/bin/env js
mobicontrol.message.createYesNoDialog('System Update available. INSTALL NOW?').withCallback(onConfirm).show();

function onConfirm(result) {
    if (result.isYesButton) {
        mobicontrol.log.info('The Yes button was clicked');
         mobicontrol.os.installSystemUpdate('/sdcard/HE_DELTA_UPDATE_10-16-10.00-QG-U120-STD-HEL-04.zip');
    } else if (result.isNoButton) {
        mobicontrol.log.info('The No button was clicked');
    } else if (result.isDismissed) {
        mobicontrol.log.info('The dialog was dismissed');
    }
}

In the log I'm getting the following result:
Custom log (Wrapped java.lang.IllegalArgumentException: method net.soti.mobicontrol.script.javascriptengine.hostobject.os.OsHostObject.installSystemUpdate argument 1 has type net.soti.mobicontrol.script.javascriptengine.hostobject.io.FileHostObject, got org.mozilla.javascript.NativeString (UserScript#6))

Kind regards,
Patrick

C
Chris
3 years ago

Hello Patrick,

I have got an answer from our TAM:

Das Script mobicontrol.os.installSystemUpdate bringt die not supported Meldung wenn das Gerät eine / mehrere der Bedingungen erfüllt:

  • Android 9 oder tiefer
  • Samsung ELM
  • Android Management als Work Profile oder COPE (nicht fully managed)

Mit einem Zebra mit Android 10 oder höher müsste der Befehl also funktionieren. In den internen Test-Tasks kann ich sehen, dass es mit einem Zebra Gerät mit Android 10 getestet wurde.

Die Syntax von deinem Script-Befehl ist kein Problem denke ich. Du kannst ggf. die Datei direkt in der Variable angeben:

var osfile = new mobicontrol.io.File('/path/to/file/firmware.zip');

mobicontrol.os.installSystemUpdate(osfile);

My test with an Android 11 device (Zebra MC93) has shown me the same error as your test. I think this is the problem:

  • Android Management als Work Profile oder COPE (nicht fully managed)

MFG

Chris

PI
Patrick I.
3 years ago

Hi Chris,

thanks for the quick reply.

We're enrolling our devices through StageNow using a SOTI Enrollment Profile with the Management Type 'Work Managed'. I assume that's equivalent to 'Work Profile'.

Do you by chance know how to enroll Zebra devices as fully managed through StageNow? Is this even possible?

Kind regards,

Patrick

C
Chris
3 years ago

Hi Patrick,

I think it is possible but I don't know how. We use the Work Managed Profile.

MFG

Chris

Similar Discussions