MOVEit Automation custom scripts use Microsoft VBScript or PowerShell. In addition to the basic functions provided by that environment, MOVEit Automation also makes available several MOVEit-specific functions.
The functions and subroutines, and associated details are listed in alphabetical order in the following table.
The functions and subroutines are described as follows:
Function call example:
VBScript: errcode =
MISetDestHost(ConfiguredHostName [,idest])
PowerShell: $errcode
= $miaclient.MISetDestHost($ConfiguredHostName,””)
Where MISetDestHost is the function name
errcode
is the return value
ConfiguredHostName
is the required argument
idest
is an optional argument.
Functions and Subroutines |
Description |
||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
MIAddFile CacheFilename, AssignedFilename |
Adds a file to the list of files to be sent to destinations. Note: Before you use MIAddFile, you must have already created a temporary file in the cache with your data in it. For more information, see Application Notes for an example of how this is accomplished. CacheFilename - The name of the temporary file to send. This name comes from the MINewCacheFilename() call below. AssignedFilename - The name to be given to the file on the destination server. The filename can be specified with forward slash ( To prevent infinite loops, scripts are not currently run on files added via MIAddFile. |
||||||||||||||
DirName = MICacheDir() |
Returns the full path of the directory where MOVEit Automation keeps its temporary files |
||||||||||||||
FileName = MICacheFilename() |
Returns the name of the temporary copy of the file in the cache. This file can be overwritten or modified if the custom script needs to change the contents of the file before it is transferred. |
||||||||||||||
FilesString = MICacheFiles() |
Returns a string containing the subdirectories and filenames for all active files in the cache. These names are relative to MICacheDir and reflect the actual names on disk in the cache directory, not the original names from the sources. The names are separated by the pipe (|) character. The last file does not have a | at the end. This list is empty immediately after a call to MIIgnoreFiles. The list does not include, for instance, the names of zip files that have been downloaded from sources marked "Uncompress Archives". |
||||||||||||||
bOK = MIDeleteFileSecure(Filename) |
Overwrites the specified file with random bytes, and then deletes the file. Returns True if successful. |
||||||||||||||
MIDirAddEntry FilenameToMatch, Date, Size, bIsDir, FilenameForGet, FilenameOriginal |
Adds an entry to the FTP or SSH directory listing that is being parsed. This should be called only from custom directory parsing scripts. For more information, see Custom Directory Parsing |
||||||||||||||
sDirListing = MIDirGetListing() |
Returns the entire verbatim listing from the FTP or SSH server. Call this function only from custom directory parsing scripts. For more information, see Custom Directory Parsing. |
||||||||||||||
DbgLevel = MIGetDebugLevel() |
Returns the debug level currently set in MOVEit Automation. Values: Level Meaning 0 Internal errors 10 Task/File Errors 20 Task/File Warnings 30 Task Completions 40 File Completions 50 Some Debug 60 More Debug 70 All Debug |
||||||||||||||
OriginalFilename=MIGetOriginalFilename() |
Returns the original filename of the file. |
||||||||||||||
Result = MIGetTaskInfo(InfoString) |
Returns the specified information about the current task. Values:
|
||||||||||||||
ParamValue = MIGetTaskParam(ParamName) |
Returns the value of the specified task parameter. If the current task has no such parameter, the empty string is returned. There are some times that the parameters need to be ‘cast’ to another type after they are brought into a script. For more information, see Application Notes. |
||||||||||||||
MIIgnoreFiles [bDeleteOrigIfCfg [,bKeepAsNew]] |
Causes all files already downloaded or added via MIAddFile to be ignored in subsequent processing steps. For example, use this if your custom script creates a zip file containing the downloaded files, and you do not want the downloaded files to be sent.
|
||||||||||||||
MIIgnoreThisFile [bDeleteOrigIfCfg [,bKeepAsNew]] |
Causes the current file to be ignored by subsequent processing steps. |
||||||||||||||
MILogMsg Message |
Logs a message to system log file. In the log file, the message is preceded by the task name. |
||||||||||||||
MyString = MIMacro(MacroText) |
Evaluates the macro MacroText and returns the resulting text. MacroText can contain any combination of macros. The MacroText attribute must be enclosed in square brackets surrounded by single quotes. For example, in PowerShell $miaclient.MIMacro(‘[Origname]’) will return the original file name of the file currently being processed in the script. |
||||||||||||||
FileName = MINewCacheFilename() |
Returns a new, unique temporary filename. The filename will be a full path and will be in the cache folder. This name is used by your script if you need to create a new file that you want added to the list of files that should be moved to a destination. Note that this just returns a name. The script is responsible for actually creating a file using this name. |
||||||||||||||
bOK = MIReplaceCacheFile(Filename) |
Securely deletes the current temporary cache file, and replaces it with the contents of Filename. For example, use this to send a different file, such as a file that you just created, instead of the downloaded file. Typically you first call MINewCacheFilename() to get a filename, then create a new file using that name, dd content to this file, and then call MIReplaceCacheFile() to tell MOVEit Automation to use the new file |
||||||||||||||
retval = MIRunCommand(Command) |
Runs a Windows system command through the Windows system command interpreter. Command is a command, such as "Notepad MyFile.txt". This can be the name of a command, such as an .exe or .bat file, or the name of a file with an associated extension, such as .vbs, or a built-in CMD.EXE command such as DIR. MIRunCommand waits until the command is complete. If you want the custom script to continue running while the command runs, use the Windows START command to launch the program. MIRunCommand returns either:
Note: Windows does have the ability disable short path capability. In this case, you will need to rename the executable without spaces.
|
||||||||||||||
errcode = MISetDestHost(ConfiguredHostName [,idest]) |
Changes the intended destination host of the current file, so that this file is copied to this host. ConfiguredHostName is the name of one of the configured hosts such as "XYZ Corp FTP Server", not an Internet host domain name. The new host does not need to be the same type as the destination being changed. For example, the destination can be of type FileSystem, but you can change it to point to an FTP server. Only the current file being processed (if any), and any files added via MIAddFile during this run of the process, are affected. If you are using this command to switch between hosts of different types (for example, between FTPS and MOVEit Transfer servers) use the "MISetDestPath" command to ensure that destination paths are properly parsed. Use a value of " idest is the ordinal number of the destination to change. Default is 1, which means the first destination in the task. (Most tasks have only one destination.) Returns an error code:
|
||||||||||||||
errcode = MISetDestPath(NewPath [,idest]) |
Changes the intended destination path of the current file, so that this file is copied to the new path on the originally specified destination/host. NewPath is the new path or directory name. idest has the same meaning that it does for MISetDestHost. Only the current file being processed (if any), and any files added via MIAddFile during this run of the process, are affected. Returns an error code:
|
||||||||||||||
MISetErrorCode NumericErrorCode |
Sets the error code and error description for this process. If the custom script determines that the file should not be transferred, it calls MISetErrorCode with a non-zero numeric error code and MISetErrorDescription with a textual description of the error. This information is recorded by MOVEit Automation, and the file is not sent. If the special value 5000 is set by MISetErrorCode, MOVEit Automation ignores the file. That is, it does not send the file, does not delete the original file, and does not flag an error that would cause the task to fail. Returning error code 5000 can be used to ignore unwanted files without alarming operators by having the task marked as unsuccessful. See also MIIgnoreThisFile If the special value 5010 is set by MISetErrorCode, MOVEit Automation does not count this process as having been run. Ordinarily, MOVEit Automation marks a task has having completed successfully (as opposed to "No actions taken") if any process runs, even if no files were downloaded or uploaded. However, if all processes in a task call MISetErrorCode 5010, and no files are transferred, then that task run is considered to have completed with "No actions taken". This affects which Next Actions are executed at the end of the task |
||||||||||||||
MISetErrorDescription ErrorDescription |
Sets the error code and error description for this process. If the custom script determines that the file should not be transferred, it calls MISetErrorCode with a non-zero numeric error code and MISetErrorDescription with a textual description of the error. This information is recorded by MOVEit Automation, and the file is not sent. If the special value 5000 is set by MISetErrorCode, MOVEit Automation ignores the file. That is, it does not send the file, does not delete the original file, and does not flag an error that would cause the task to fail. Returning error code 5000 can be used to ignore unwanted files without alarming operators by having the task marked as unsuccessful. See also MIIgnoreThisFile If the special value 5010 is set by MISetErrorCode, MOVEit Automation does not count this process as having been run. Ordinarily, MOVEit Automation marks a task has having completed successfully (as opposed to "No actions taken") if any process runs, even if no files were downloaded or uploaded. However, if all processes in a task call MISetErrorCode 5010, and no files are transferred, then that task run is considered to have completed with "No actions taken". This affects which Next Actions are executed at the end of the task |
||||||||||||||
MISetFilename NewFilename |
Changes the name under which the current file should be stored at the destination. Do not include a path in NewFilename. |
||||||||||||||
MISetStatus StatusText |
Set the status text to be displayed by MOVEit Automation Admin while the script is running. This can be used by long-running scripts to inform the operator the status of the process. If MISetStatus is not called, the message "Running script scriptname" is displayed. |
||||||||||||||
MISetTaskParam ParamName,ParamValue |
Sets the value of the specified task parameter ParamName. If the current task has no such parameter, a parameter of that name is created. Parameter names are not case-sensitive. |
||||||||||||||
MISleep Milliseconds |
Suspends the custom script for the specified number of milliseconds. Very little processor time is consumed during the pause. |
||||||||||||||
ErrCode = MIStartTask(TaskNameOrID [,TaskParams]) |
Starts the specified task. TaskNameOrID is either a task name or a task ID. (MOVEit Automation checks first for a task name match.) TaskParams allows you to specify values for task parameters. If a parameter name matches the name of a parameter configured in the task definition, the new value overwrites the configured value. The format of TaskParams is Example 1: Run a task called ShowMyID that shows the value of the ID stored in variable
Example 2: A task called SendSummaryFile is started with two task parameters computed from within the script:
Returns 0 if the task was started. Note: the task will probably still be running when this function returns; a 0 return code does not mean that the task will successfully run to completion |
||||||||||||||
TaskGroups = MITaskGroups() |
Returns the names of the task groups to which the task belongs. This is a string containing the names of all applicable groups, separated by |. For example, the result might be "Daily|For Argus Bank|By Fred", or just "". You can process this in VBScript by creating an array from it using the Split function. |
||||||||||||||
TaskName = MITaskname() |
Returns the name of the task that is running the custom script. |