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.

Environment Variables

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.

Composition

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!"

Substring

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
Showmessagebox "%Var1%"
would show "Hello World" on the device screen.

Errorlevel

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.

Variable Initialisation Using System Information

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:

User script commands

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 .cmd file extension.

  • To get Pocket Word to open the document notes.doc:
    pword notes.doc
  • To run a script file called "test.cmd":
    test.cmd

Y

Y

N

N

;

Script comment.

Syntax:
; this is a comment

 

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:
@dir

Y

Y

N

N

1:

Select the drive/file system. The mobile device file system is denoted by 1:.

To switch to the c: drive on your desktop computer:

c:

Y

Y

Y

N

abortpkg

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

abortsync

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 169.254.0.1):
set firstoctet=ipoctet %IP% 1
if %firstoctet%==169 abortsync

Y

Y

N

N

agent_mode

Retrieves the current agent mode (user or administrator) of a device with lockdown mode applied and displays it in the Devices tab information panel.

agent_mode

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

appcontrol -b

N

N

Y

Y

apply

apply <policy>

Allow to configure device feature control policy through script, using following format:

writeprivateprofstring DeviceFeature <parameter> <value>
apply featurecontrol

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:

writeprivateprofstring DeviceFeature DisableCamera 1
apply featurecontrol

N

N

N

Y

attrib

Displays or changes file attributes.

Syntax:
attrib [+R | -R] [+A | -A] [+S | -S] [+H | -H] [drive:][path][filename]

"+" sets an attribute.

"-" clears an attribute.

"R" is the read-only file attribute.

"A" is the archive file attribute.

"S" is the system file attribute.

"H" is the hidden file attribute.

attrib +A 1:\database_info.txt

Y

Y

N

N

batteryoptimize

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

batteryoptimize allow | disable package

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

N

N

N

Y

cd

Changes the current directory.

To change to the Windows directory:

cd Windows

Y

Y

N

N

certdelete

Delete the certificate from the device.

Note

On Android devices, you can only use certdelete to remove certificates that were installed by unless the device has a Samsung ELM agent installed, in which case certdelete will remove any specified certificates.

Syntax:
certdelete -issuer "<IssuerName>" -sn "<SerialNumber>"
-storage "<storage>"

"<IssuerName>" is the common name of the certificate issuer.

"<SerialNumber>" is serial number of the certificate the type of storage into which to import the certificate.

 

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

Y

N

N

Y

certimport

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:

certimport -cert "<filepath>" -stype "<storagetype>"
-storage "<storage>"

Where

"<filepath>" is the relative or absolute path of the certificate (.cer) file to import.

"<storagetype>" is the type of storage into which to import the certificate. Not all OSs support all available options:

  • "CSSCS" is the current system service certificate storage.
  • "CSSCU" is the current user certificate storage.
  • "CSSCUGP" is the current user group policy certificate storage.
  • "CSSLM" is the local machine certificate storage.
  • "CSSLME" is the local machine enterprise certificate storage.
  • "CSSLMGP" is the local machine group policy certificate storage.
  • "CSSS" is the system services certificate storage.
  • "CSSU" is the user's certificate storage.

"<storage>" specifies storage into which to import the certificate. Available options are not supported by all OSs:

  • "MY" is the personal user certificate storage.
  • "ROOT" is the root certificate storage.
  • "CA" is the certificate authority certificate storage.
  • "Trust" is the trusted certificate storage.
  • "SPC" is the software publisher certificate storage.

Android devices

certimport -cert "<filepath>" -stype "<storagetype>"
-storage "<storage>"

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 MobiControl. It's recommended to omit the -storage argument

Windows To import a certificate test.cer into current user storage of "MY" type :
certimport -cert "test.cer"

Windows To import a certificate test.cer into root user storage of the local machine:
certimport -cert "test.cer" -storagetype "CSSLM" -storage "ROOT"

Android To import a certificate test.cer into current user storage:
certimport -cert "test.cer" -ctype CERT

Y

Y

N

Y

cls

Clears the screen.

 

Y

Y

N

N

connect

Tells the device agent to try to connect to the deployment server.

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

connect -f

N

N

Y

Y

copy

Copies one or more files to another location.

Syntax:
copy <source> <destination>

Files can be copied between the desktop computer and mobile devices.

Note:

On the Android and Android+ platforms, files can only be copied locally on the device.

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

copy c:\temp\*.txt 1:\temp

Y

Y

Y

Y

del

Deletes one or more files.

Syntax:
del <filename>

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

Y

Y

Y

Y

devrename

Renames a device.

Syntax:
devrename <new device name>

devrename "new device name"

N

N

Y

Y

dir

Displays a list of files and subdirectories in a directory.

Syntax:
dir [drive:][path][directoryname]

To list the files in the Temp directory of the mobile device enter the following command (the mobile device file system is denoted by 1: ):

dir 1:\Temp\

Y

Y

N

N

disconnect

Disconnects the device from MobiControl.

 

N

N

Y

Y

echo

Displays messages, or turns command-echoing on or off.

  • To turn command echoing off:
    echo off
  • To turn command echoing on:
    echo on
  • To display the message "Copying Files ...":
    echo Copying Files ...

Y

Y

N

N

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.

To add ELM agent to whitelist:

elm_awaken 1

To remove ELM agent from whitelist:

elm_awaken 0

N

N

N

Y

exit

Closes the remote help desk application window.

 

Y

Y

N

N

find

Syntax:
find [/s] [filename]

"/s" is to search files in subfolders.

"filename" is the file specification for which you are searching.

To search for all files with a .txt file extension including subfolders:

find /s *.txt

Y

Y

N

N

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.

When a hard reset is initiated from a package's post-install script, the entire package will re-install 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 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:

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


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

if exist "1:\PersistantStorage\subfolder" finishpkg

Y

Y

N

Y

foregroundmode

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:

foregroundmode enable|disable

To switch to foreground mode:

foregroundmode enable

 

To switch back to normal mode:

foregroundmode disable

N

N

Y

Y

format_volume

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 list_volumes command in order to derive the needed mount path against listed volume.

The stages of format are also indicated using message dialogs. The operation results are indicated to remote server via console logs.

Syntax:

format_volume mountpath

To format a removal SD card:

format_volume "/mnt/sdcard/external1"

N

N

Y

N

ftp [get|wget] [-r,-o] sourcedest

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:

ftp get -o ftp://user:password@server/folder/file.txt %sdcard%file.txt

 

Copy whole folder from "folder" to "www" on the device:

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

N

N

Y

Y

goto

Directs script execution to a labelled line in a script. This command is for use only in scripts.

To go to label ":end":
copy *.* 1:\tmp

goto end

...

:end

Y

Y

N

N

help or ?

Displays a list of the commands supported and a brief description of each command.

 

Y

Y

N

N

identify_activity

This command is used to identify current (top) activity on the device.

identify_activity

N

N

Y

Y

identify_package_certificate

Displays signature of package to device ADB logs.

Syntax:
identify_package_certificate [package name]

identify_package_certificate com.my.helloworld

N

N

Y

Y

if

If errorlevel is greater than or equal to <number> (or less than <number> if "not" is present), then execute <command>:
if [not] errorlevel <number> <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 [not] (<string> | %<environment variable>% ) == (<string> | %<environment variable>%) <command>

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 1:\ to specify device root folder:
if [not] exist <file/folder name> <command>

If <processname.extension> is found running in the memory of the device, then execute <command>. If [not] is specified and the <processname.extension> is not found running in memory, execute <command>:
if [not] procexists <Processname.extension> <command>

Notes:

  • <environment variable> and <string> can be any Unicode character string.
  • <command> can be any script command including the if command, which means the if command can be nested.

  • if errorlevel 0 echo "errorlevel is greater/equal to 0"
  • if abc==%xyz% echo "value of environment variable xyz is equal to abc"
  • If a variable contains white space, then the string must be within "".
    if "%name%==John Smith" echo "This is John Smith"
  • if exist "1:\IPSM\abc.cab" echo "1:\IPSM\abc.cab exists"
  • if procexists filesys.exe echo yes
  • if errorlevel 0 if not errorlevel 1 echo "errorlevel is 0"

Y

Y

N

N

ifconfig

Displays the configuration of the network interfaces on the Web Console.

Syntax:
ifconfig [interface name] [option]

Notes:

  • To list all interfaces, use all as the interface name.
  • If no interface name is provided, then all is used as the default interface name.
  • The -i option is available when all is used as the interface name. This option displays the interface names only.

ifconfig all

ifconfig

ifconfig all -i

ifconfig eth0

N

N

Y

Y

install

Install application on the device.

Syntax:
install <path_to_app_installer>

<path_to_app_installer> is the full path to the application installer file on the device.

install /mnt/sdcard/Gmail.apk

Y

N

Y

Y

install_system_update

Installs a system update from the specified file. It is currently implemented on Motorola Android systems only.

Notes:

  • Motorola ET1 cannot recognize "/mnt/sdcard" volume in recovery mode, so to specify update package in sdcard, please use "/sdcard" instead of %sdcard%.
  • If the device is encrypted, this script command will generate an error. In such cases you must use the sendintent script command instead.

install_system_update /sdcard/et1.zip

N

N

N

Y

installpackage

Installs a MobiControl package built from the Package Studio.

Syntax:
installpackage <path_to_package> now

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 %tmp% folder:

installpackage %tmp%package1.pcg now

N

N

N

Y

ipaddr

Displays all applicable IP addresses for all network interfaces on the Web Console.

 

N

N

Y

Y

ipoctet

Returns the specified octet of an IP address and saves it to an environment variable, when called from within a MobiControl device script.

Syntax:
ipoctet <IP Address> <Octet number>

Please see the Environment Variables section above for more information.

  • To save the value of the fourth octet of an IP address to the environment variable myOctet:
    set myOctet=ipoctet 192.168.1.225 4
    This gives myOctet the value 225.
  • To save the value of the first octet of the device's IP address to an environment variable in a device script:
    set myOctet=ipoctet %IP% 1
    This gives myOctet the value 192 if the IP address is of the form 192.XXX.XXX.XXX.

Y

Y

N

N

itcssconfig

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:
itcssconfig <xmlfile.xml>

This command will take the supplied XML file containing the SmartSystems request and in return, create an output file in the same directory with *.out.* inserted before the extension. The command passes the XML files to SmartSystems API without modification, so it will accept any valid request (either "Get" or "Set"). It's possible to use XML files generated with SmartSystems Console.

Please see the Intermec SmartSystems Settings: Advanced XML Scripting page for more information.

  • itcssconfig 1:\FullPath\itcss.xml
    Response: itcss.out.xml
  • XML script that enables "Code 39" decoding in all devices in the Scanners group:
    <Subsystem Name="Data Collection">
    <Group Name="Scanners" Instance="0">
    <Group Name="Symbologies">
    <Group Name="Code 39">
    <Field Name="Enable Code 39">1</Field>
    </Group>
    </Group>
    </Group>
    </Subsystem>

Y

N

N

N

kill

Terminates a process that is currently running on the mobile device.

Syntax:
kill <executable filename>

To terminate the pword.exe process on the mobile device:

kill pword.exe

Y

Y

N

N

kill_application

Terminates a process that is currently running on the mobile device.

Syntax:
kill_application <package name>

To terminate the com.rovio.angrybirds process on the mobile device:

kill_application com.rovio.angrybirds

N

N

N

Y

list_volumes

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

Syntax:

list_volumes

 

N

N

Y

N

lock

Turns device screen off and, if there is a password, next time it asks for the password.

 

N

N

Y

Y

lockdevice

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:
lockdevice <minutes>

To lock a device for 1 minute

lockdevice 1

Y

N

N

N

lockdownorientation

Sets the orientation of the device lockdown (kiosk) screen.

Syntax:

lockdownorientation <orientation>

Any parameter other than landscape or portrait causes the kiosk screen to default to landscape for Android Honeycomb and later, and to portrait for Gingerbread.

 

To orient the lockdown screen as landscape:
lockdownorientation landscape

To orient the lockdown screen as portrait:
lockdownorientation portrait

N

N

Y

Y

log

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:
log <type> <message>

"log" is the command.

"<type>" is the type of message that should get associated. The options are:

  • Error (-e)
  • Warning (-w)
  • Information (-i)

"<message>" is the message that will be displayed in the device log in MobiControl Web Console.

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:
*** Command in the Pre-Install Script ***
log -i "Starting Software Push"

Y

Y

Y

Y

malwarescan

Starts a Webroot scan for malware on the device.

 

N

N

N

Y

mkdir or md

Creates a directory.

Syntax:
mkdir [drive:] < path>

  • To create a directory named "test" from the current directory:
    md test
  • To create "test\test1\test2\test3" recursively:
    md test \test1 \test2 \test3

Y

Y

Y

Y

move

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:
move [source file path]<filename> <destination file path>[filename]

This operation can be approximated on the Android and Android+ platforms by doing a copy followed by a deletion.

  • To move a file test.bat:
    move test.bat 2:\
    move test.bat 2:\test.bat
  • To move and rename a file at the same time:
    move 1:\test.bat 2:\test2.cmd

Y

Y

N

N

mxconfig

mxconfig <xml_filepath>

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 /sdcard/test.xml

N

N

N

Y

mxxmlconfig

mxxmlconfig [inputPath] [outputPath]

Executes XML command from the [inputPath] and puts the result into the [outputPath].

inputPath – path to a xml file containing configuration for MX XML API

outputPath – path to a folder where script execution result will be put.

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

 

N

N

Y

Y

notify

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:
notify <alias>

Alias is a friendly name for kiosk app.

notify <package> <receiver>

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

These two commands are equal:

notify kiosk

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

N

N

Y

Y

pause

Prompts and waits for user input to continue. This command is only for use in scripts or .CMD files.

Syntax:
pause

Example:
pause

Display:
Press any key to continue...

Y

Y

N

N

promptpasswordchange

Prompts "Password policy pending" notification on agent to request the user to set a password for the device.

 

N

N

Y

Y

ps

Lists the running processes on the mobile device.

 

Y

Y

N

N

RcOrientationFix

Changes the orientation of the display image of a device that is remote controlled

Syntax:
writeprivateprofstring RcOrientationFix <manufacturer>_<model><value>

Where

  • <manufacturer> is from android.os.Build.MANUFACTURER("ro.product.manufacturer") and falling back to android.os.Build.BRAND("ro.product.brand") if the manufacturer is unknown
  • <model> is from android.os.Build.MODEL("ro.product.model")
  • <value> is one of the following:
    • CW denotes clockwise
    • CCW denotes counter-clockwise
    • NONE denotes no rotation
    • UPSIDEDOWN denotes upside-down
To change the screen orientation of your device:

writeprivateprofstring RcOrientationFix samsung_SM-G900W8 CW

N

N

N

Y

regdelkey

Deletes a key from registry on the mobile device.

Syntax:
regdelkey <registry key>

To delete registry key HKEY_CLASSES_ROOT\.2bp:

regdelkey HKEY_CLASSES_ROOT\.2bp

Y

Y

N

N

regdelval

Deletes a value from the registry on the mobile device.

Syntax:
regdelval <registry key>\<value name>

To delete registry value HKEY_CURRENT_USER\Start\test:

regdelval HKEY_CURRENT_USER\Start\test

Y

Y

N

N

registerdll

Registers or unregisters a DLL on the mobile device.

To register a DLL:

registerdll <dll filename>

To unregister a DLL:

registerdll -u <dll filename>

Register example:
registerdll MCSetup.dll

Unregister example:
registerdll -u MCSetup.dll

Y

N

N

N

regload

Imports a registration file to the registry on the mobile device.

Syntax:
regload <registry file path>

To import registration file c:\test.reg to the mobile device's registry:

regload c:\test.reg

Y

Y

N

N

regsave

Exports the mobile device registry subtree to a file.

Syntax:
regsave [-A | -U] [drive:][path]filename subtree[regpath]

"-A" is for ANSI format of output file.

"-U" is for UNICODE format of output file (default).

"[drive:][path]filename" is a file to where registry subtree will be saved.

"subtree[regpath]" specifies what part of device's registry will be exported. Possible values are:

  • "*" for everything (no 'regpath')
  • "HKLM" for HKEY_LOCAL_MACHINE
  • "HKCU" for HKEY_CURRENT_USER
  • "HKCR" for HKEY_CLASSES_ROOT

To export the HKEY_LOCAL_MACHINE subtree from the mobile device registry to a UNICODE file C:\hklm.reg:

regsave -U C:\hklm.reg HKEY_LOCAL_MACHINE

Y

Y

N

N

regset

Adds a key or a value to registry on the mobile device.

Syntax:
regset <registry key> [value name] [data]

To add a new key and two values to that key:

regset HKLM\software\apps testkey

regset HKLM\software\apps\testkey testvalue1 abc

regset HKLM \software \apps \testkey testvalue2 dword:123

Y

Y

N

N

rem

Inserts a comment line in a script/batch file.

 

Y

Y

Y

Y

removemanagedinfo

removemanagedinfo <package_name>

Removes Samsung managed info for specified application.

 

N

N

N

Y

rename or ren

Renames a file or folder.

Syntax:
rename <source filename> <destination filename>

This operation can be approximated on the Android and Android+ platforms by doing a copy followed by a deletion.

To rename the file test.txt to test.bak:

ren test.txt test.bak

Y

Y

N

N

replacetxt

Changes all occurrences of a particular character or string in the specified file.

Syntax:
replacetxt <filename> <string to replace> <new string>

Example:
replacetxt "\Temp\My Device.txt" Device Psion

Y

Y

N

N

reset

Performs a soft or hard reset of the device.

Syntax:

reset [/S(Default)| /H | /W | /E] [/delay <sec>]

• reset /S : (Default) To soft reset the device and also close the desktop remote control session if the device is being remote controlled.

• reset /H : To hard reset a device running Windows Pocket PC or Windows CE platforms. This command will result in clearing data stored in 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.

• reset /W : To perform the secure deletion of data stored on the device as well as a reset to factory default settings. Please note that the wipe command is only supported on the Windows Mobile 5 operating system with AKU2 or later and newer versions of Windows Mobile.

For Android+ and Android: it is possible to specify /delay parameter. For example:

reset /s /delay 10

means execute command in 10 seconds. If /delay parameter is not defined command will be executed in 5 seconds (default value).

To soft reset a device:

reset /s

Reset the device to its factory settings in 30 seconds:

reset /e /delay 30

Note:

The reset /H and reset /W commands will perform a system reboot similar to restart on Windows Desktop Agent. The reset /S and reset /H commands will perform the same action on Android and Android+ – a system reboot.

Y

Y

Y

Y

resetpassword

Reset device password to new password.

Syntax:
resetpassword <new password>

resetpassword 12345

Y

N

Y

Y

resetwifiproxy <ssid>

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.

resetwifiproxy 105

N

N

Y

Y

restartagent

Restarts the agent.

restartagent

N

N

Y

Y

rmdir or rd

Removes (deletes) a directory.

Syntax:
rmdir [/S] path

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

    Location should be provided:
    rmdir /mnt/sdcard/test

  • To remove a directory named "test" and all of its contents:
    rmdir /S test

Note:

On Android and Android+ platforms, this command must be used with the /S option, and will delete the specified item whether it is a directory or a file.

Y

Y

Y

Y

sendintent

sendintent <-a|-s|-b> <intent_uri>

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:

  • String - S
  • Boolean - B
  • Byte - b
  • Character - c
  • Double- d
  • Float - f
  • Integer - i
  • Long - l
  • Short - s

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 toLock with a value of "lock":

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

sendreport

Sends a debug report from the device agent to the FTP server.

sendreport

N

N

Y

Y

sendsms

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:
sendsms [recipient (s)] "[message]"

Separate recipient phone numbers with a semi-colon ";".

  • To send an SMS message to 1 number:
    sendsms 416-555-0505 "This is a test message"
  • To send an SMS message to multiple numbers:
    sendsms 416-555-0505;905-555-5050;919-555-5500 "This is a test message"

Note:

The device receiving the SMS must have MobiControl installed in order for the command to complete successfully.

Y

N

N

N

set

Set, edit or show values of environment variables.

Syntax:

"set" lists all environment variables.

"set <environment variable>" shows the value of <environment variable>

"set <environment variable>=" deletes <environment variable>

"set <environment variable>=<string>" sets the value of <environment variable> to <string>

"set <environment variable>=substring "<string>" <startpos> [numberofchars]" sets the value of <environment variable> to the string returned by the substring command. (The substring command returns part of the string based on starting position and number of characters specified.)

"set <environment variable>++" increments the value of <environment variable>. The variable must have an integer value.

"set <environment variable>--" decrements the value of <environment variable>. The variable must have an integer value.

  • set Var1=test will set the value of variable Var1 to "test".
  • set Var2=substring testing 1 4 will set the value of variable Var2 to "test".

Y

Y

N

N

set_system_update_policy

This script command can be used to configure System Update Policy for AFW devices.

Syntax:

set_system_update_policy<policy type>[start time] [end time]

Policy Types

0 - Default

Same as plaform's default behavior

1 - Automatic

Install update automatically as soon as one is available

2 - Windowed

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.

3 - Postpone

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.

  • Set system update policy as default:

    set_system_update_policy 0

  • Set system update policy as automatic:

    set_system_update_policy 1

  • Set system update policy as windowed:

    set_system_update_policy 2 1380 180

  • Set system update policy as postpone:

    set_system_update_policy 3

N

N

N

Y*

setdate

Sets the date and time.

 

Syntax:

setdate <date> [time]

Usage:

setdate <mm-dd-yyyy> [HH:MM:SS]

To set the date and time of the device:

setdate 08-20-2009 13:32:00

Y

N

N

N

setfirewallproxy <host> <port>

Sets proxy configuration on device level (iptables based). Supported for Samsung MDM v2 and higher devices.

setfirewallproxy 192.168.2.127 8080

N

N

N

Y

setlocale <locale>

Sets device default locale. Supported only on Android+ devices with signed agent and on Motorola devices.

setlocale en_CA

N

N

N

Y

setmobiledata

Enables/disables mobile data of the remote device.

These settings may conflict with DFC, and settings are non-restrictive and non-persistent.

Syntax:

setmobiledata <1/0>

To disable phone radio:

setmobiledata 0

 

To enable phone radio:

setmobiledata 1

N

N

Y

Y

setradioenable

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:

setradioenable <wifi/bt/phone> <1/0>

To disable Bluetooth radio:

setradioenable bt 0

 

To enable Bluetooth radio:

setradioenable bt 1

N

N

Y

Y

setwifiproxy <ssid> <host> <port>

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.

setwifiproxy 105 192.168.2.127 8080

N

N

Y

Y

shellexecute

Launches the registered application for the given file extension.

Syntax:

shellexecute <filepath> <-verb> [-w<seconds>]

To launch the registered application for the given file extension:

shellexecute 1:\temp\temp.upg -open

shellexecute 1:\temp\temp.upg -run -w5

Y

Y

N

N

showmessagebox

Shows a message box on the device screen.

Syntax:

showmessagebox <message> [timer] [type] [default button]

"<message>" is the message shown in the message box. Use quotation marks if there are spaces in the message.

"[timer]" is the number of seconds until the message box is closed automatically. If you omit a timer value or add the keyword or the keyword NO_TIMER is present, the message box will persist until the device user dismisses it. For message box types 1 and 5, timer is optional.

"[type]" is the message box type (optional):

  • "1" is for an information window with an OK button.
  • "2" is for a question window with Yes (default) and No buttons.
  • "3" is for a warning window with an OK button.
  • "4" is for a question window with OK (default) and Cancel buttons.
  • "5" is for an error window with an OK button.

"[default button]" (Optional) is for use with the keywords YES and NO to set the default button for 2 and 4. In the case of 4, YES is OK and NO is Cancel.

The return values for showmessagebox are stored in a global variable ShowMessageBoxReturn. This variable can be used in scripts as %ShowMessageBoxReturn% to execute actions based on user interaction. 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.

Note:

The Android agent has the following limitations:

  • It does not support a complex showmessagebox script that contains more than one command.
  • It cannot return the user response.
  • It does not support "if" and related keywords.

  • showmessagebox "This is a test message"
  • showmessagebox "Your device's IP address is %IP%"
  • showmessagebox "This is a test message with a 3 second timer" 3
  • showmessagebox "This is a test message with Yes/No button and no timer" NO_TIMER 2
  • showmessagebox "Abort the operation?" NO_TIMER 4 YES if % ShowMessageBoxReturn %== IDYES goto Exit

Y

Y

Y

Y

shutdown

This command powers off the device.

Syntax:
shutdown <delay>

<delay> – (optional) parameter: delay the power off of the device. If not specified, the default is 5 seconds.

Power off device in 5 seconds:

shutdown

Power off device in 30 seconds:

shutdown 30

N

N

Y

Y

sleep

Sleep for a specified number of seconds. This command is for use only in scripts.

To sleep for 5 seconds:
sleep 5

Y

Y

Y

Y

sleepex

Sleep for a specified number of milliseconds. This command is for use only in scripts.

To sleep for 3.5 seconds:
sleepex 3500

Y

Y

Y

Y

smsreportpn

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 smsreportpn command has been provided to acquire the device's current phone number via an SMS message exchange with another device running the MobiControl agent.

Upon completion of the message exchange the phone number is set in the following registry section:

"HKLM\Software\Apps\SOTI\" with the key name of "PhoneNumber".

The registry key value will be set on the target device.

Syntax:

smsreportpn <phone number>

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:

smsreportpn 9675555555

Note:

There will be a total of two SMS messages, one from each device (the originating and target devices).

Y

N

N

N

start

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

On Windows devices, you must enclose the (filepath to the) application in quotation marks. For example, "\software\apps\xyz.exe" .

To start Pocket Word and wait until it is terminated:

start /wait "pword"

 

For Android platform

Start <packagename>

or

start activity <package>/<activity>

Y

Y

Y

Y

turnoff

This script command shuts down the device.

turnoff

Y

Y

Y

Y

type

Displays the contents of a Unicode text file.

To display the contents of the file test.cmd:

type test.cmd

Y

Y

N

N

uninstall

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:
uninstall [/w] <program>

"/w" is to wait for the uninstallation to complete before proceeding in a script.

"program" is for the program id to be removed.

Program id appears in the Remove Programs applet in the device's control panel.

To remove the program Google Maps:

uninstall "com.google.maps"

Y

N

Y

Y

uninstall_agent

Removes the agent, gracefully cleaning up previously applied policies before finally uninstalling itself. This process could take up to 30 seconds.

The uninstall_agent command cannot uninstall a Samsung ELM agent due to permission limitations.

Note:

Some feature modules not handling wipe/rollback properly could hamper a clean uninstall.

uninstall_agent

N

N

N

Y

unlock

Unlocks the device and dismisses the password lock screen.

unlock

N

N

Y

Y

updatedefinitions

Causes Webroot to update the malware definitions.

 

N

N

N

Y

wifiapenable

Enables or disables WiFi mobile AP. Supported for Android 4.0 and higher devices.

Syntax:

wifiapenable [parameter]

 

Parameters:

  • 1: Enable AP.
  • Any other value: Disable AP.

 

N

N

Y

Y

wifireconnect

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

wipeapplication

Wipes application data for the specified application from the device.

wipeapplication <package_name>

N

N

N

Y

writeprivateprofstring

Writes a string into the registry under the PDB registry path as well as the pdb.ini file.

Syntax:

writeprivateprofstring <section> [key] [value]

"section" is the name of the section in the .ini file to which the value is to be written. If the section does not exist, it is created. The name of the section is case-sensitive.

"key" is the name of the key. If the key does not exist in the specified section, it is created. If this parameter is not entered, the entire section, including all entries within it, is deleted.

"value" is the string to be written to the file. If this parameter is not entered, the key is deleted.

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:

writeprivateprofstring Device DeviceName MyDevice

Y

Y

Y

Y

writeprofstring

Writes a string into the specified section of an initialization file.

Syntax:

writeprofstring <filename> <section> [key] [value]

"filename" is the name of the .ini file.

"section" is the name of the section in the .ini file to which the value is to be written. If the section does not exist, it is created. The name of the section is case-sensitive.

"key" is the name of the key. If the key does not exist in the specified section, it is created. If this parameter is not entered, the entire section, including all entries within it, is deleted.

"value" is the string to be written to the file. If this parameter is not entered, the key is deleted.

Use quotes if either the key or the value contains whitespace.

To set the Color key in the "Video" section of the \Movie\mov.ini file to a value of "Red":

writeprofstring \Movie\mov.ini Video Color Red

Y

Y

N

N

writesecureprofstring

This command is exactly the same as writeprivateprofstring, except that the data being written is not logged.

writesecureprofilestring Auth adminPassword Welcome1234

N

N

Y

Y

xmlconfig

Loads the specified XML configuration file to the operating system.

Syntax:

xmlconfig <xmlfile.xml>

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.

xmlconfig 1:\FullPath\xmlfile.xml

Note:

The complete path for the XML file must be provided.

Y

N

N

N

© SOTI Inc.
Contact us