Script Commands for Android Classic Devices

Use the options and examples below to help you create your own powerful script commands.

Note: Not all script commands are compatible with all devices within a platform. Limitations are noted in the table entries.
Tip: You can also use JavaScript to create and send scripts to your Android Plus devices. See Android Plus JavaScript Scripts for details.

Legend

Format Meaning
text Enter the command exactly as shown.
text Replace with the requested information.
[text] Information contained within square brackets is optional to the command.
text|text Choose one of the options separated by the vertical pipe.

Commands

Command Syntax
abortpkg

Halts the installation of a package and forces the installation status in the SOTI MobiControl console to report "Failed" when used in a SOTI MobiControl pre-install script.

See Using Package Studio for more information.

abortpkg
agent_mode

Retrieves the current agent mode (user or administrator) of a device with lockdown mode applied and displays it in the Logs section of the Device Information panel.

agent_mode
appcontrol

Applies blacklist rules. This command supports a limited set of parameters.

appcontrol [-s|-b|-w] containerID

Where

  • -s clears application run control rules
  • -b adds an application to the blacklist
  • -w adds an application to the whitelist
  • containerID is the ID of the application

Example

To add the Facebook app to the blacklist:

appcontrol -b com.facebook.appmanager

batteryoptimize

Specifies if an application should adhere to the battery optimization restrictions.

Note: Supported on Samsung Android devices with Samsung MDM 5.7 or later, that are enrolled with either a 13.6 Samsung ELM agent or a 13.6 Android Enterprise with Samsung ELM license enabled agent.
batteryoptimize allow | disable package

Example

To add an application to the Battery Optimization whitelist (app will ignore battery optimization restrictions):

batteryoptimize disable com.microsoft.office.outlook

To remove an application from the Battery Optimization whitelist (app will follow battery optimization restrictions):

batteryoptimize allow com.microsoft.office.outlook

certdelete

Deletes a certificate on the device.

Note: You can only use certdelete to remove certificates that were installed by SOTI MobiControl unless the device has a Samsung ELM agent installed, in which case certdelete will remove any specified certificates.
certdelete -issuer "IssuerName" -sn "SerialNumber" -storage "storage"

Where

  • IssuerName is the common name of the certificate issuer
  • SerialNumber is the serial number of the certificate
  • storage is the type of storage into which to import the certificate

Example

To delete a certificate issued by apache.org:

certdelete -issuer "*.apache.org" -sn 00A03DB42A7841AFF5

certimport

Imports a user-specified certificate of X.509 type, which could be either DER or Base64 encoded.

certimport -cert "filepath" -ctype certificate_type -pwd "password" -itype "install_type" -storage "storage_type"

Where

  • filepath is the relative or absolute path of the certificate (.cer) file to import.
  • certificate_type is either CERT or PKCS12
  • -pwd "password" -itype "install_type" -storage "storage_type" are optional arguments and do not need to be included in the script
  • "password" is a string with the pfx password
  • "install_type" is either silent (default) or ui
  • storage is the storage location into which to import the certificate. MY, the only supported alternative option, installs the certificate in a keystore only usable from SOTI MobiControl. It's recommended to omit the -storage argument

Example

To import a certificate test.cer into current user storage:

certimport -cert "test.cer" -ctype CERT

connect

Prompts the device agent to attempt to connect to the deployment server.

connect [-f]

Where -f forces the device agent to connect regardless of configuration or setup settings.

Example

To connect to the deployment server regardless of configuration or setup settings:

connect -f

copy

Copies one or more files to another location.

On Windows Mobile/CE and Desktop Classic devices, files can be copied between desktop computers and mobile devices.

On Android devices, files can only be copied locally.

copy source destination

Example

To copy all files with the extension .txt from the C:\ to the temp directory on the device:

C:\tempt\*.txt 1:\temp

del

Deletes one or more files.

del filename

Example

To delete example.txt in the current directory:

del example.txt

To delete all files with the extension .tmp in the current directory and its subfolders:

del *.tmp

devrename

Renames a device.

devrename newDeviceName

If the name contains spaces, use quotation marks

Example

To change the name of a device to Apricot Candy:

devrename "Apricot Candy"

disconnect

Disconnects the device from the SOTI MobiControl deployment server.

disconnect
elm_awaken

Adds or removes the Samsung ELM agent to/from Android Doze Mode whitelist, enabling the agent to circumvent battery optimizations that limit connectivity between the agent and the deployment server.

Available on Samsung devices running Android 6.0 or later and Knox Standard SDK 5.7 or later.

elm_awaken 0|1

Example

To add ELM agent to whitelist:

elm_awaken 1

To remove ELM agent from whitelist:

elm_awaken 0

enable_system_app

Allows a system application on the device to be used in the Android Enterprise container.

Note: Only applications that are included in the device's firmware can be used in this command.
enable_system_app appBundleID

Example

To add Google Chrome to the Android Enterprise container:

enable_system_app com.android.chrome

finishpkg

Finishes the current script without processing the rest of the package and reports package installation as successful to the deployment server. This is useful particularly in packages that involve wiping a device. This script command can be used to skip reinstalling the package but still report back as successfully installed to the deployment server.

If a hard reset is initiated from a package's post-install script, the entire package will reinstall after the reset. A check can be included in the pre-install script that determines whether the package's files have already been installed.

Note: This command is not useful as a script command in and of itself but in the event of a package that involves a cold boot.
"path\to\package"finishpkg

Example

"1:\PersistentStorage\subfolder" finishpkg

For platforms that support the if command, you use finishpkg conditionally: If a package's post-install script contains:

md "1:\PersistentStorage\subfolder"reset /w

then the pre-install script could contain a check to prevent the package from being reinstalled endlessly:

if exist "1:\PersistentStorage\subfolder" finishpkg

foregroundmode

Switches the SOTI MobiControl service between foreground and background modes. While running in foreground mode the SOTI MobiControl process receives high priority and is not killed by the system.

While the service is running in foreground mode, a SOTI MobiControl icon is displayed in the notification area of the device.

foregroundmode enable|disable

Example

To enable foregroundmode

foreground enable

ftp

Copies a file or directory from an ftp server.

ftp [get|mget|wget] [-r,-o] source destination

Where

  • get copies a file on the ftp server to the local computer
  • wget copies a file on the local computer to the ftp server
  • -r specifies recursive
  • -o specifies to override existing files

Example

To copy a file from ftp to local SD card on the device:

ftp get -o

To copy a folder from the device to ftp server:

ftp wget -o -r ftp:://user:password@server/folder %sdcard%www

httpget

Downloads files using the HTTP protocol.

httpget URL localPath
identify_activity

Identifies the current top activity on the device.

identify_activity
identify_package_certificate

Identifies the signature of a package and displays it in the device ADB logs.

identify_package_certificate packageName

Example

identify_package_certificate com.my.helloworld

ifconfig

Displays the configuration of the network interfaces on the SOTI MobiControl console.

ifconfig interfaceName

Where if no interfaceName is provided, then all is used as the default and lists all interfaces.

Use -i with all to display the interface names only.

Example

To list all interface names:

ifconfig all -i

To show the configuration of eth0 interface

ifconfig eth0

install

Installs an application on the device.

install appInstallerPath

Where appInstallerPath is the full path to the application installer file on the device

Example

To install the Gmail app located on an sd card:

install /mnt/sdcard/Gmail.apk

install_system_update

Installs a system update from the specified file.

Note: This command cannot be used on encrypted devices. Use the sendintent command instead.
install_system_update filename

Example

To install a system update from a file on an SD card:

install_system_update /sdcard/et1.zip

Note: If /sdcard does not work, use /storage/sdcard0 instead, as in:

install_system_update /storage/sdcard0/et1.zip

installpackage

Installs a SOTI MobiControl package built using Package Studio.

Note: This command is not recursive and can only be used through the console or an API call to install a previously sideloaded package. It is not intended for use within one package to install another package.
installpackage pathToPackage

Example

To install a package from the %tmp% folder:

installpackage %tmp%package1.pcg now

ipaddr

Lists the IP addresses of the device.

ipaddr
kill_application

Terminates a process that is currently running on the device.

Requires

  • Android Classic
  • Android Enterprise
    • Agent: 14.0.0
kill_application packageName

Example

To terminate the Angry Birds game process on the device

kill_application com.rovio.angrybirds

list_volumes

Lists storage volume information of remote managed device. The results are displayed using a custom event on the console.

list_volumes
lock

Turns the device screen off and locks device until device user enters the correct password.

lock
lockdownorientation

Sets the orientation of the device screen while its in lockdown or kiosk mode.

lockdownorientation orientation

Where orientation is either landscape or portrait

Note: Setting any parameter other than landscape or portrait causes the kiosk screen to default to landscape for Android Honeycomb (3.0) and later, and to portrait for Android Gingerbread (2.3).

Example

To set the orientation of the lockdown screen to landscape:

lockdownorientation landscape

To set the orientation of the lockdown screen to portrait:

lockdownorientation portrait

log

Sends a customs message to the SOTI MobiControl deployment server from the device. This message appears in the Logs tab of the Device Information panel in the SOTI MobiControl console.

log type message

Where type is the type of the associated message and the options are:

  • -e for Error
  • -w for Warning
  • -i for Information

Example

To send a notification to the SOTI MobiControl console at certain intervals during a software push:

Note: Put the command in the pre-install script

log -i "Starting Software Push"

malwarescan

Initiates a Webroot scan for malware on the device.

malwarescan
mkdir or md

Creates a new directory.

mkdir [drive:] path

Example

To create a directory named "test" from the current directory:

mkdir test

To create test\test1\test2\test3 recursively:

mkdir test \test1 \test2 \test3

mxconfig

Submits XML configuration instructions to the MX layer of the device.

Note: This script command is only applicable on Zebra Android devices. mxconfig uses the StageNow XML format (MXMS)
mxconfig xmlFilepath

Example

mxconfig /sdcard/test.xml

mxxmlconfig

Executes an xml command from the inputPath and puts the result into the outputPath.

Note: This command is only supported on devices that support the older XML format (MX Legacy).
mxxmlconfig inputPath outputPath

Where

  • inputPath is the path to an xml file containing configuration settings for MX XML API.
  • outputPath is the path to a folder for the script execution result
notify kiosk

Enables or disables lockdown mode on the device.

notify kiosk on | off
notify

Sends a script that notifies other SOTI applications about data sync. You can use it to notify lockdown applications that lockdown view synchronized.

Added in v9 to support re-enrolling a device on another SOTI MobiControl system

notify alias or notify package receiver

Where alias is a friendly name for the kiosk app.

Example

To notify kiosk about data sync:

notify kiosk or

notify net.soti.mobicontrol.lockdown net.soti.mobicontrol.lockdown.LockDownUpdateReceiver

promptpasswordchange

Prompts user to change or set a password on their device by displaying a "Password Policy Pending" notification in the device agent.

promptpasswordchange
rem

Inserts a comment line in a script/batch file.

rem [comment]

Example

To add a comment about pumpkins:

rem The pumpkins are looking great this harvest

removemanagedinfo

Removes Samsung managed information for specified applications.

Note: This command is only available on Samsung devices.
removemanagedinfo packageName
request_appops_permission

Sends a request to the device prompting the device user to grant the specified permissions.

request_appops_permission permissionName where the permissionName can be one of:
  • SYSTEM_ALERT_WINDOW requests the Draw Over permission. Requires an Android Classic or Enterprise agent of 13.5.2 or later
  • PACKAGE_USAGE_STATS requests the Usage Access permission. Requires an Android Classic or Enterprise agent of 13.6.1 or later
  • BIND_NOTIFICATION_LISTENER_SERVICE requests the Notification Access permission. Requires an Android Classic or Enterprise agent of 13.6.1 or later.
  • WRITE_SETTINGS requests the Modify System Settings permission. Requires an Android Classic or Enterprise agent of 13.7.0 or later

Where possible, the permissions are granted silently.

reset

Performs a soft or hard reset of the device.

reset [/S | /H | /W | /E] [/delaysec]

Where

  • /S is the default option and soft resets the device. Any desktop remote control sessions will also be terminated.
  • /H is used to hard reset a device running on the Windows Pocket PC or Windows CE platforms. It clears any data stored in the volatile memory. On Windows Mobile 5.0 and later devices this is equivalent to a soft reset. The real-time clock may also reset depending on the device make and model.
  • /W is used to wipe data stored on the device and reset the device to factory default settings.
    Note: The wipe command is only supported on the Windows Mobile 5 operating system with AKU2 or later and newer versions of Windows Mobile.
  • /E is used to wipe data stored on the device and its external storage as well as reset the device to factory default settings.
  • /P is used to bypass factory reset protection. It is only supported on Android Enterprise Work Managed devices.

On Android Plus devices it is possible to specify a /delay parameter (in seconds): reset /S /delay 10

If /delay parameter is not defined, the default value is 5 seconds

Example

To soft reset a device:

reset /S

To reset an Android Plus device to its factory settings in 30 seconds:

reset /E /delay 30

resetpassword

Resets device password to new password.

resetpassword newPassword

Example

To reset current password to password12345

resetpassword password12345

resetwifiproxy

Clears proxy configuration settings for the specified SSID (which should exist on the device before sending the command).

Note: Supported on devices running Android 4.0 or later.
resetwifiproxy ssid

Example

To reset a proxy configuration for SSID 105:

resetwifiproxy 105

restartagent

Restarts the device agent.

restartagent

As of Android agent v14.3.1, the agent waits until it's idle before it restarts (generally less than 10 seconds). Add --immediately if you want to restart the agent as soon as the script is received. Earlier versions of the agent restart immediately.

rmdir or rd

Deletes a directory.

rmdir [/S] path

Where /S removes any subdirectories

On Android Plus and Linux devices, this command requires the /S option and will delete the specified item whether it is a directory or a file.

Example

To remove an empty directory named "test" from the current directory:

rmdir test

To remove a directory named "test" and all of its contents from the current directory:

rmdir /S test

To provide location:

rmdir /mnt/sdcard/test

sendinfo net.soti.action.surf BROWSERZOOMLEVEL

Sets the zoom level in the SOTI Surf app.

sendinfo net.soti.action.surf BROWSERZOOMLEVEL value

Where value is a percentage that represents the level of zoom.

Example

To set the zoom level of the SOTI Surf app to 400%:

sendinfo net.soti.action.surf BROWSERZOOMLEVEL 400

sendinfo net.soti.action.surf DISABLEBROWSERZOOMGESTURE

Controls whether device users can use gestures (like pinch to zoom) to magnify web pages opened in the SOTI Surf app.

sendinfo net.soti.action.surf DISABLEBROWSERZOOMGESTURE 0|1

Where

  • 0 enables zoom gestures
  • 1 disables zoom gestures

Example

To disable zoom gestures in the SOTI Surf app:

sendinfo net.soti.action.surf DISABLEBROWSERZOOMGESTURE 1

sendinfo net.soti.action.surf ENABLETHIRDPARTYCOOKIES

Controls whether cookies from third-party domains (that is, domains beyond the site the user is currently visiting) are blocked on SOTI Surf.

sendinfo net.soti.action.surf ENABLETHIRDPARTYCOOKIES 0|1

Where

  • 0 blocks third-party cookies
  • 1 allows third-party cookies

Example

To allow third-party cookies in the SOTI Surf app:

sendinfo net.soti.action.surf ENABLETHIRDPARTYCOOKIES 1

sendinfo net.soti.action.surf DISABLEMEDIAAUTOPLAY 0 / sendinfo net.soti.action.surf DISABLEMEDIAAUTOPLAY 1

Turns on or off media auto-play and controls SOTI Surf access to the device camera.

sendinfo net.soti.action.surf DISABLEMEDIAAUTOPLAY 0 | 1

Where 0 turns on media auto-play and 1 turns off media auto-play.

Example

To turn on media auto-play and grant SOTI Surf access to the device camera:

sendinfo net.soti.action.surf DISABLEMEDIAAUTOPLAY 0

sendintent

Sends intent to devices.

See The sendintent Command for more information

sendreport

Sends a debug report from the device agent to the SOTI ftp server.

sendreport
setfirewallproxy

Sets proxy configuration on device level (iptables based).

Note: Supported on devices with Samsung MDM v2 and later only.
setfirewallproxy host port containerID

Example

setfirewallproxy 192.168.2.127 8080

setlocale

Sets the device's default locale.

Note: Supported on Motorola Android Plus devices with a signed agent only.
setlocale locale
setmobiledata

Enables or disables mobile data on a device.

Note: These settings may conflict with device feature control, and settings are non-restrictive and non-persistent.
setmobiledata 0|1

Where 0 disables mobile data and 1 enables mobile data.

Example

To disable mobile data:

setmobiledata 0

To enable mobile data

setmobiledata 1

setradioenable

Enables or disables WiFi, Bluetooth, or cellular networks for the device. If the phone radio is disabled, no telephony functionalities in terms of both audio and data can occur. A phone reboot will typically re-enable the radio again.

Note: These settings may conflict with device feature control, and settings are non-restrictive and non-persistent.
setradioenable wifi|bt|phone 0|1

Where

  • wifi is WiFi
  • bt is Bluetooth
  • phone is Cellular
  • 0 disables the radio
  • 1 enables the radio

Example

To disable Bluetooth radio

setradioenable bt 0

To enable WiFi

setradioenable wifi 1

setwifiproxy

Sets WiFi proxy settings using a provided host and port for the specified SSID. The access point ID should exist on the device before sending this command.

Note: Supported on devices running Android 4.0.
setwifiproxy ssid host port

Example

To set up a WiFi proxy:

setwifiproxy 105 192.168.2.127 8080

setwifipacurl

Sets WiFi proxy settings using a provided PAC file. The access point ID should exist on the device before sending this command.

Note: Supported on devices running Android 4.0.
setwifipacurl ssid PACfileURL

Example

To set up a WiFi proxy using a PAC file:

setwifipacurl 105 https://website.com/proxy.pac

showmessagebox

Displays a message box on the device screen.

Note: The Android Plus agent has the following limitations:
  • It does not support a complex showmessagebox that contains more than one command
  • It cannot return the user response
  • It does not support "if" and related keywords
showmessagebox message [timer] [type] [default button] [action]

Where

  • message is the message displayed in the message box. Use quotation marks (" ") if there are spaces in the message.
  • [timer] is the number of seconds until the message box disappears automatically. If you omit a timer value or add the keyword NO_TIMER, the message box will persist until the device user dismisses it.
  • [type] is type of of message box. Options are:
    • 1 displays an information window with an OK button
    • 2 displays a question window with Yes and No buttons
    • 3 displays a warning window with an OK button
    • 4 displays a question window with OK and Cancel buttons
    • 5 displays an error window with an OK button
  • [default button] sets the default buttons for message box types 2 (YES | NO) or 4 (OK | CANCEL)
  • NOTIFY_DEVICE notifies the device user of the message, depending on the notification settings applied to the device. That is, devices set to ring, will ring, set to vibrate, will vibrate, and muted devices will have no notification. Only supported on Android Plus devices with agents 14.0.0 or later.

The return values for the showmessagebox are stored in a global variable, ShowMessageBoxReturn This variable can be used in scripts as %ShowMessageBoxReturn% to execute actions based on user response. Possible return values are IDYES, IDNO, IDOK, IDCANCEL. The value for this global variable does not change if the type is not 2 or 4.

Example

To show a simple message:

showmessagebox "This is a test message"

To provide device information using a macro:

showmessagebox "Your device's IP address is %IP%"

To set a 3 second timer to your message:

showmessagebox "This is a test message with a 3 second timer" 3

To add YES and NO buttons to your message box with no timer

showmessagebox "This is a test message with Yes/No button and no timer" NO_TIMER 2

To provide followup actions to a user response to message box:

showmessagebox "Abort the operation?" NO_TIMER 4 YES
if %ShowMessageBoxReturn% == IDYES goto Exit
shutdown

Turns off the device.

shutdown [delay]

Where delay is a time period in seconds.

Example

To turn off the device:

shutdown

To turn off the device in 25 seconds:

shutdown 25

sleep

Initiates sleep mode on the device for a set period. Only use this command in scripts.

sleep [length]

Where length is in seconds

Example

To set the device to sleep for 5 seconds:

sleep 5

sleepex

Initiates sleep mode on the device for a set period. Only use this command in scripts.

sleep [length]

Where length is in milliseconds

Example

To set the device to sleep for 3.5 seconds:

sleep 3500

start

Starts a program on the device. When the /wait option is specified, the script processor waits for the initiated program to terminate before executing the next command in the script.

start [/wait] program
Note: On Windows devices, program must be enclosed in quotation marks.

Example

To start Pocket Word and wait until it is terminated:

start /wait "\software\apps\pword.exe"

turnoff

Shuts down the device. You can specify a delay (in milliseconds) before shutdown.

turnoff [time]

Example

To turn off the device in 3.5 seconds:

turnoff 3500

uninstall

Removes the specified program from the device.

uninstall program [force]

Where

  • program is the program ID for the program you want to uninstall
  • force forces uninstallation of the program, even if it is a system application

Example

To remove the program Google Maps:

uninstall com.google.maps

uninstall_agent

Removes the agent from the device and clears any previously applied policies. This process can take up to 30 seconds.

Note: This command cannot uninstall a Samsung ELM agent due to permission limitations. Additionally, some feature modules do not handle wipe/rollback properly and can hamper a clean uninstall.
uninstall_agent
unlock

Unlocks the device and dismisses the password lock screen.

unlock
updatedefinitions

Prompts Webroot to update its malware definitions.

updatedefinitions
wifiapenable

Enables or disables WiFi mobile access point.

Note: Supported on devices running Android 4.0 to 8.0.
wifiapenable 0|1

Where 0 disables WiFi and 1 enables WiFi

Example

To disable WiFi:

wifiapenable 0

wifireconnect

Forces the device to drop a WiFi connection and reconnect.

Note: Supported on devices running Android 4.0 or later with Android Plus capabilities.
wifireconnect
wipeapplication

Wipes application data for the specified application from the device.

wipeapplication packageName
writeprivateprofstring

Saves or deletes specified settings on a device.

See The writeprivateprofstring Command for more information.

writesecureprofstring

This command has the same functionality as writeprivateprofstring except that the data that is being written is not logged.

See The writeprivateprofstring Command for more information.