Script Command Set |
Note:
All scripts will be terminated within 5 minutes. This is an expected behavior of the application to ensure the script engine is not hung indefinitely.
In general, an environment variable's name and value can be any ASCII character string; however, certain strings are reserved or have special meanings. (See below.) You refer to the value of an environment variable by enclosing it in "%" characters. You can use these expressions with any of the above commands in place of a literal value.
Example:
The command "showmessagebox %myVar%" would display a message box containing the value of the variable myVar.
You can compose the values of environment variables.
Example:
The two commands "set var1=Hello" and "set var2=%var1% world!" give var2 the value "Hello world!"
You can pull parts of information from a string and put them as a variable.
Example:
set Var1=Substring "Hi Hello World Goodbye" 4 11 would show "Hello World" on the device screen.
Showmessagebox "%Var1%"
The system reserved variable errorlevel always has an integral value. You can assign integer values to this variable, but you cannot delete it.
Example:
set errorlevel=9.
A number of special strings allow you to extract information from the device and store it in an environment variable. You can extract this information from the following five sources:
TXT://\<filename>?LN=<line number>.Example:
The command "set myVar=TXT://policy.txt?LN=5" stores line 5 of the file policy.txt in the variable myVar.
REG://<key>?VN=<value name>." Example:
set myVar=REG://HKEY_LOCAL_MACHINE\Windows CE Tools?VN=Platform
.Ini file: To extract a value from a .ini file, use a string of the form "INI://\<filename>?SC=<section>&NM=<name>." Example:
set myVar=INI://settings.ini?SC=Config&NM=PreferredOption
EXE://<command line>. " Example:
The command "set myVar=EXE://scansystem /o" runs the command "scansystem /o" and stores its return code in myVar.
STDOUT://<command line>." Example:
The command "set myVar=STDOUT://checkmessages" runs the command "checkmessages" and stores the first line of its output in myVar.
The following table lists the commands available in MobiControl and the platforms that support each command.
| Command | Description | Examples | Windows Mobile | Windows Desktop | Android | Android+ |
|---|---|---|---|---|---|---|
|
To run a program on the mobile device or to execute a script file. |
Enter the name of a program or command file followed by any command-line arguments. All script files must have the |
|
Y |
Y |
N |
N |
|
|
Script comment. Syntax: |
Y |
Y |
Y |
Y |
|
|
|
Prefix any command by this character to stop the command from being displayed when executing commands in a script file. |
To hide the output from the dir command: |
Y |
Y |
N |
N |
|
|
Select the drive/file system. The mobile device file system is denoted by |
To switch to the |
Y |
Y |
Y |
N |
|
|
Aborts the installation of a package and forces it to show up as "Failed" in MobiControl Web Console, when used in a MobiControl pre-install script. Please see the MobiControl Package Studio page for more details. |
Y |
Y |
N |
Y |
|
|
|
Aborts the file synchronization process, when used in a MobiControl Pre-Sync script. Please see the File Sync Rule page for more details. |
To abort file synchronization if the first octet of the device's IP address is 169 (i.e. the IP is of the form |
Y |
Y |
N |
N |
|
|
Retrieves the current agent mode (user or administrator) of a device with lockdown mode applied and displays it in the Devices tab information panel. |
|
N |
N |
N |
Y |
appcontrol
|
Apply black list rules. Supports only limited set of parameters: -s – clear application run control rules -b – apply black list -w – apply white list |
|
N |
N |
Y |
Y |
|
|
Allow to configure device feature control policy through script, using following format:
where value 0=disable, 1=enable, parameter will be based on Device Feature Control policy. |
To disable the camera using device feature control option through script:
|
N |
N |
N |
Y |
|
|
Displays or changes file attributes. Syntax: " " " " " " |
|
Y |
Y |
N |
N |
|
|
Specifies if an application should adhere to the battery optimization settings. 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. Syntax
|
To add an application to the Battery Optimization whitelist (app will ignore battery optimization restrictions):
To remove an application from the Battery Optimization whitelist (app will follow battery optimization restrictions):
|
N |
N |
N |
Y |
|
|
Changes the current directory. |
To change to the |
Y |
Y |
N |
N |
|
|
Delete the certificate from the device. Note On Android devices, you can only use Syntax: " "
|
|
Y |
N |
N |
Y |
|
|
Imports a user-specified certificate of X.509 type, which could be either DER or Base64 encoded. Syntax (differs between Windows and Android devices): Windows devices:
Where " "
"
Android devices
Where
|
Windows To import a certificate Windows To import a certificate Android To import a certificate |
Y |
Y |
N |
Y |
|
|
Clears the screen. |
Y |
Y |
N |
N |
|
|
|
Tells the device agent to try to connect to the deployment server.
|
|
N |
N |
Y |
Y |
|
|
Copies one or more files to another location. Syntax: Files can be copied between the desktop computer and mobile devices.
On the Android and Android+ platforms, files can only be copied locally on the device. |
To copy files with the extension |
Y |
Y |
Y |
Y |
|
|
Deletes one or more files. Syntax: |
To delete To delete all files with the extension |
Y |
Y |
Y |
Y |
|
|
Renames a device. Syntax: |
|
N |
N |
Y |
Y |
|
|
Displays a list of files and subdirectories in a directory. Syntax: |
To list the files in the |
Y |
Y |
N |
N |
disconnect
|
Disconnects the device from MobiControl. |
N |
N |
Y |
Y |
|
|
|
Displays messages, or turns command-echoing on or off. |
|
Y |
Y |
N |
N |
|
|
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. |
To add ELM agent to whitelist:
To remove ELM agent from whitelist:
|
N |
N |
N |
Y |
|
|
Closes the remote help desk application window. |
Y |
Y |
N |
N |
|
|
|
Syntax: " " |
To search for all files with a |
Y |
Y |
N |
N |
|
|
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.
This command is of no consequence as a script command but only useful in the event of a package that involves cold boot. |
If a package's post-install script contains: |
Y |
Y |
N |
Y |
|
|
Switches the MobiControl service between foreground and background modes. While running in foreground mode the MobiControl process will receive high priority and will not be killed by the system. While the service is running in foreground mode, a MobiControl icon will be displayed in the notification area. Syntax:
|
To switch to foreground mode:
To switch back to normal mode:
|
N |
N |
Y |
Y |
|
|
Formats external and removal storage volume on a remotely managed device. The user is expected to provide the volume mount path as the parameter. This command typically goes with The stages of format are also indicated using message dialogs. The operation results are indicated to remote server via console logs. Syntax:
|
To format a removal SD card:
|
N |
N |
Y |
N |
|
|
This command copies a file or directory from ftp.
Options: -o – override existing -r – recursive
If override is not set command will emulate resume. Files where file size is matched with local file size. Such files will be skipped. |
Copy file from ftp to local sdcard on the device.
Override existing:
Copy whole folder from "folder" to "www" on the device:
|
N |
N |
Y |
Y |
|
|
Directs script execution to a labelled line in a script. This command is for use only in scripts. |
To go to label ":end": |
Y |
Y |
N |
N |
|
|
Displays a list of the commands supported and a brief description of each command. |
Y |
Y |
N |
N |
|
|
|
This command is used to identify current (top) activity on the device. |
identify_activity
|
N |
N |
Y |
Y |
|
|
Displays signature of package to device ADB logs. Syntax: |
|
N |
N |
Y |
Y |
|
|
If errorlevel is greater than or equal to <number> (or less than <number> if "not" is present), then execute <command>: If two operands are identical (not identical if "not" is present) execute <command>. The operand can be a string constant or environment variable: If a file or folder exists (does not exist, if "not" is present) execute <command>. If directory information is specified in the <file/folder name> then search in the directory, otherwise search in current directory. Use If
|
|
Y |
Y |
N |
N |
|
|
Displays the configuration of the network interfaces on the Web Console. Syntax:
|
|
N |
N |
Y |
Y |
|
|
Install application on the device. Syntax:
|
|
Y |
N |
Y |
Y |
|
|
Installs a system update from the specified file. It is currently implemented on Motorola Android systems only.
|
|
N |
N |
N |
Y |
|
|
Installs a MobiControl package built from the Package Studio. Syntax: Note This command is not recursive and can only be used through the web console or an API call to install a previously sideloaded package. It is not intended for use within one package to install another package. |
Installing package from
|
N |
N |
N |
Y |
|
|
Displays all applicable IP addresses for all network interfaces on the Web Console. |
|
N |
N |
Y |
Y |
|
|
Returns the specified octet of an IP address and saves it to an environment variable, when called from within a MobiControl device script. Syntax: Please see the Environment Variables section above for more information. |
|
Y |
Y |
N |
N |
|
|
Loads the specified XML configuration file to the operating system. This command is applicable only to Intermec devices with Intermec SmartSystems. The complete path to the XML file must be provided. Syntax: This command will take the supplied XML file containing the SmartSystems request and in return, create an output file in the same directory with Please see the Intermec SmartSystems Settings: Advanced XML Scripting page for more information. |
|
Y |
N |
N |
N |
|
|
Terminates a process that is currently running on the mobile device. Syntax: |
To terminate the |
Y |
Y |
N |
N |
|
|
Terminates a process that is currently running on the mobile device. Syntax: |
To terminate the |
N |
N |
N |
Y |
|
|
Lists storage volume information of remote managed device. The results are displayed using a custom event on the Web Console. Syntax:
|
|
N |
N |
Y |
N |
|
|
Turns device screen off and, if there is a password, next time it asks for the password. |
|
N |
N |
Y |
Y |
|
|
Initiates a lock screen on a device for the specified number of minutes. Note minimum time to set is 1 minute. Lock screen counts down the time remaining by minute until it reaches 1 minute and then counts down each second. Syntax: |
To lock a device for 1 minute |
Y |
N |
N |
N |
|
|
Sets the orientation of the device lockdown (kiosk) screen. Syntax:
Any parameter other than
|
To orient the lockdown screen as landscape: To orient the lockdown screen as portrait: |
N |
N |
Y |
Y |
|
|
Sends a custom message back to MobiControl deployment server from the mobile device. This message will show up in the LOG panel of the mobile device in the Devices View (tab) in MobiControl Web Console. Syntax: " "
" |
During a software push from MobiControl to your mobile device, you can use this command to send notification to MobiControl Web Console at certain intervals during the software push: |
Y |
Y |
Y |
Y |
|
|
Starts a Webroot scan for malware on the device. |
|
N |
N |
N |
Y |
|
|
Creates a directory. Syntax: |
|
Y |
Y |
Y |
Y |
|
|
Moves a file from source specified to destination specified. You can also rename the file being moved by specifying a different name for the destination filename. Syntax: This operation can be approximated on the Android and Android+ platforms by doing a copy followed by a deletion. |
|
Y |
Y |
N |
N |
|
Submits XML configuration instructions to the MX layer of the device. Note: This script command is only applicable on Zebra Android devices. |
|
N |
N |
N |
Y |
|
|
|
Executes XML command from the [inputPath] and puts the result into the [outputPath].
Note: This script command is only supported only on devices that support the odler XML format (MX Legacy). |
|
N |
N |
Y |
Y |
|
|
This command is sent in a script for notifying other SOTI applications about data sync. It is used by Android platform to notify lockdown application that lockdown view synchronized It could be supported by Windows Mobile as a WM_COPY_DATA or other RPC Syntax: Alias is a friendly name for kiosk app.
Added in v9 to support re-enrolling a device on another MobiControl system. |
These two commands are equal:
|
N |
N |
Y |
Y |
|
|
Prompts and waits for user input to continue. This command is only for use in scripts or .CMD files. Syntax: |
Example: Display: |
Y |
Y |
N |
N |
|
|
Prompts "Password policy pending" notification on agent to request the user to set a password for the device. |
|
N |
N |
Y |
Y |
|
|
Lists the running processes on the mobile device. |
Y |
Y |
N |
N |
|
|
|
Changes the orientation of the display image of a device that is remote controlled Syntax: Where
|
To change the screen orientation of your device:
|
N |
N |
N |
Y |
|
|
Deletes a key from registry on the mobile device. Syntax: |
To delete registry key |
Y |
Y |
N |
N |
|
|
Deletes a value from the registry on the mobile device. Syntax: |
To delete registry value |
Y |
Y |
N |
N |
|
|
Registers or unregisters a DLL on the mobile device. To register a DLL:
To unregister a DLL:
|
Register example: Unregister example: |
Y |
N |
N |
N |
|
|
Imports a registration file to the registry on the mobile device. Syntax: |
To import registration file |
Y |
Y |
N |
N |
|
|
Exports the mobile device registry subtree to a file. Syntax: " " " "
|
To export the |
Y |
Y |
N |
N |
|
|
Adds a key or a value to registry on the mobile device. Syntax: |
To add a new key and two values to that key: |
Y |
Y |
N |
N |
|
|
Inserts a comment line in a script/batch file. |
Y |
Y |
Y |
Y |
|
|
|
Removes Samsung managed info for specified application. |
|
N |
N |
N |
Y |
|
|
Renames a file or folder. Syntax: This operation can be approximated on the Android and Android+ platforms by doing a copy followed by a deletion. |
To rename the file
|
Y |
Y |
N |
N |
|
|
Changes all occurrences of a particular character or string in the specified file. Syntax: |
Example: |
Y |
Y |
N |
N |
|
|
Performs a soft or hard reset of the device. Syntax:
• • • For Android+ and Android: it is possible to specify
means execute command in 10 seconds. If |
To soft reset a device:
Reset the device to its factory settings in 30 seconds:
The |
Y |
Y |
Y |
Y |
|
|
Reset device password to new password. Syntax: |
|
Y |
N |
Y |
Y |
|
|
Resets proxy configuration for specified SSID (should exist on the device before sending the command). Supported for Android 4.0 and higher devices with Android+ capabilities. |
|
N |
N |
Y |
Y |
|
|
Restarts the agent. |
|
N |
N |
Y |
Y |
|
|
Removes (deletes) a directory. Syntax: |
On Android and Android+ platforms, this command must be used with the |
Y |
Y |
Y |
Y |
|
|
Sends intent. Takes 2 parameters: 1) Type of intent -a : Start_activity -s : Start_service -b : Start_Broadcast 2) Intent URL
There are two kinds of intent syntax for the Android system: 2.a. Intent URI, which use conventional URI format 2.b. Intent:[data URI]#Intent;[scheme of the data URI]; [action=]; [component=]; [category=]; [launchFlags=];[extra key value pair];end It is also possible to add an extra to the intent. Extra options are:
|
To open notepad: sendintent -a "intent://com.google.provider.NotePad/notes/1# Intent;scheme=content;action=android.intent.action.EDIT; component=com.example.android.notepad/.NoteEditor;end"
To play a video file: sendintent -a "intent:file:///sdcard/www/Email.wmv#Intent; type=video/x-ms-wmv;component=com.cooliris.media/.MovieView; launchFlags=0x4000000;end"
To install a system update on an encrypted Motorola device: sendintent -b "intent:#Intent; action=com.motorolasolutions.intent.action.UPDATE_PACKAGE; S.file=/sdcard/update.zip;end"
To add a String extra called sendIntent - b "intent:#Intent;action=android.intent.SES.WAKE_LOCK;S.toLock=lock;end;" To open a specific web page in your device's browser: sendintent - a "https://<URL>#Intent;action=android.intent.action.VIEW;end" |
N |
N |
Y |
Y |
|
|
Sends a debug report from the device agent to the FTP server. |
|
N |
N |
Y |
Y |
|
|
This script command can be used to send an outbound SMS (text message) from any online or ActiveSynced mobile device to 1 or more devices. Syntax: Separate recipient phone numbers with a semi-colon " |
The device receiving the SMS must have MobiControl installed in order for the command to complete successfully. |
Y |
N |
N |
N |
|
|
Set, edit or show values of environment variables. Syntax: " " " " " " " |
|
Y |
Y |
N |
N |
|
|
This script command can be used to configure System Update Policy for AFW devices. Syntax:
Policy Types
Same as plaform's default behavior
Install update automatically as soon as one is available
New system update will only be installed automatically when the system clock is inside a daily maintenance window. The maintenance window will last for 30 days, after which the system should revert back to default policy.
Set it to block installation for a maximum period of 30 days. After expiration, the system should revert back to default policy. Time Window Time window arguments are used only for the Windowed policy type. Time parameters are measured as the number of minutes from midnight in the device's local time. They must be in the range of [0-1440] If the start and end times are the same, the window is considered to include the WHOLE 24 hours, that is, updates can install at any time. If start time is later than end time, the window is considered spanning midnight. Start time - the start of the maintenance window End time - the end of the maintenance window *Note: only supported on Android for Work devices running Marshmallow (6.0) or later. |
|
N |
N |
N |
Y* |
|
|
Sets the date and time.
Syntax:
Usage:
|
To set the date and time of the device:
|
Y |
N |
N |
N |
|
|
Sets proxy configuration on device level (iptables based). Supported for Samsung MDM v2 and higher devices. |
|
N |
N |
N |
Y |
|
|
Sets device default locale. Supported only on Android+ devices with signed agent and on Motorola devices. |
|
N |
N |
N |
Y |
|
|
Enables/disables mobile data of the remote device. These settings may conflict with DFC, and settings are non-restrictive and non-persistent. Syntax:
|
To disable phone radio:
To enable phone radio:
|
N |
N |
Y |
Y |
|
|
Sets radio on/off for Wi-Fi, Bluetooth, Cellular of the remote managed device. The first parameter indicates the desired radio type and the second parameter indicates whether to enable/disable the selected radio. If the second parameter is not specified, it is considered as the disable option. Also, if the phone radio is disabled, no telephony functionalities in terms of both audio + data can occur. A phone reboot will typically re-enable the radio again. These settings may conflict with DFC, and settings are non-restrictive and non-persistent. Syntax:
|
To disable Bluetooth radio:
To enable Bluetooth radio:
|
N |
N |
Y |
Y |
|
|
Sets WiFi proxy using provided host and port for specified SSID (access point ID, should exist on the device before sending the command). Supported for Android 4.0 and higher devices with Android+ capabilities. |
|
N |
N |
Y |
Y |
|
|
Launches the registered application for the given file extension. Syntax:
|
To launch the registered application for the given file extension:
|
Y |
Y |
N |
N |
|
|
Shows a message box on the device screen. Syntax:
" " "
" The return values for
The Android agent has the following limitations:
|
|
Y |
Y |
Y |
Y |
|
|
This command powers off the device. Syntax:
|
Power off device in 5 seconds:
Power off device in 30 seconds:
|
N |
N |
Y |
Y |
|
|
Sleep for a specified number of seconds. This command is for use only in scripts. |
To sleep for 5 seconds: |
Y |
Y |
Y |
Y |
|
|
Sleep for a specified number of milliseconds. This command is for use only in scripts. |
To sleep for 3.5 seconds: |
Y |
Y |
Y |
Y |
|
|
Sends a hidden encoded SMS message to a device to store it's current phone number in the registry. Some SIM cards are not provisioned by the cellular carrier with their phone number post purchase. This prevents MobiControl from obtaining the devices phone number from the standard API calls used. The Upon completion of the message exchange the phone number is set in the following registry section:
The registry key value will be set on the target device. Syntax:
|
The following command needs to be issued via MobiControl from a device that has SMS service. The phone number in the command is the phone number of the device in question. To set a device's phone number information:
There will be a total of two SMS messages, one from each device (the originating and target devices). |
Y |
N |
N |
N |
|
|
Start a program on the mobile device. When the " On Windows devices, you must enclose the (filepath to the) application in quotation marks. For example, |
To start Pocket Word and wait until it is terminated:
For Android platform
or
|
Y |
Y |
Y |
Y |
|
|
This script command shuts down the device. |
|
Y |
Y |
Y |
Y |
|
|
Displays the contents of a Unicode text file. |
To display the contents of the file
|
Y |
Y |
N |
N |
|
|
Removes the specified program from the device. This is equivalent to uninstalling a program by using the 'Remove Programs' applet in the device's control panel. Syntax: " " Program id appears in the Remove Programs applet in the device's control panel. |
To remove the program Google Maps:
|
Y |
N |
Y |
Y |
|
|
Removes the agent, gracefully cleaning up previously applied policies before finally uninstalling itself. This process could take up to 30 seconds. The
Some feature modules not handling wipe/rollback properly could hamper a clean uninstall. |
|
N |
N |
N |
Y |
|
|
Unlocks the device and dismisses the password lock screen. |
|
N |
N |
Y |
Y |
|
|
Causes Webroot to update the malware definitions. |
|
N |
N |
N |
Y |
|
|
Enables or disables WiFi mobile AP. Supported for Android 4.0 and higher devices. Syntax:
Parameters:
|
|
N |
N |
Y |
Y |
|
|
Forces the device to drop the WiFi connection and connect again. Supported for Android 4.0 and higher devices with Android+ capabilities. |
|
N |
N |
Y |
Y |
|
|
Wipes application data for the specified application from the device. |
|
N |
N |
N |
Y |
|
|
Writes a string into the registry under the PDB registry path as well as the Syntax:
" " " Use quotes if either the key or the value contains whitespace. * On iOS and Android, this only updates the internal pdb DB. |
To change the device name to MyDevice:
|
Y |
Y |
Y |
Y |
|
|
Writes a string into the specified section of an initialization file. Syntax:
" " " " Use quotes if either the key or the value contains whitespace. |
To set the Color key in the "Video" section of the
|
Y |
Y |
N |
N |
|
|
This command is exactly the same as |
|
N |
N |
Y |
Y |
|
|
Loads the specified XML configuration file to the operating system. Syntax:
This command will take the supplied XML file and load it onto the operating system. This command is only valid on devices running Pocket PC 2003 or later. The XML file is handled by Microsoft's configuration manager. Use of this command will allow you to script in complicated device configuration schemas for easy deployment. Please see the Advanced XML Setup Script page for more details. |
The complete path for the XML file must be provided. |
Y |
N |
N |
N |