Redwood Documentation

Product Documentation

 

›Agent Definition Types

RunMyJobsPlatform Agents

External Platforms

  • Connecting Redwood Server to External Platforms

Credentials

  • Storing Credentials
  • Credential Protocols

Platform Process Servers

  • On-site Platform Process Servers
  • Cloud Platform Agents
  • Using the Wizard to Create Process Servers
  • Configuring Platform Agents
  • Spool Host Agents
  • The Environment of Platform Agent OS Processes
  • Processing Platform Processes
  • Process Server Services
  • Configuring Agentless Process Servers
  • Automatically Updating Platform Agents
  • Enabling TLS
  • Creating Monitoring Checks
  • Configuring Load Balancing on Platform Agents
  • Platform Agent Registry Entries
  • Monitoring Servers with Platform Process Servers

UNIX Agents

  • UNIX Process Servers
  • UNIX Process Server Configuration Data
  • File Events on UNIX
  • Creating UNIX Process Servers (Advanced)
  • Choosing a User Switching Security Mode
  • Controlling Unix Platform Agents
  • Uninstalling Redwood Server Platform Agents from UNIX

Windows Agents

  • Creating a Microsoft Windows Process Server
  • File Events on Microsoft Windows Process Servers
  • Configuration of a Microsoft Windows Process Server
  • Managed Services
  • Configuring Platform Agents on Microsoft Windows
  • Automating Windows tasks that require a desktop window
  • Uninstalling Redwood Server from Microsoft Windows

Agent Definition Types

  • Using the BASH Definition Type
  • Using the KSH Definition Type
  • Using the CSH Definition Type
  • Using the Perl Definition Type
  • Using the Python Definition Type
  • Using the PowerShell Definition Type
  • Using the Visual Basic Script Definition Type
  • Using the CMD Definition Type
  • Using the R Process Definition Type
  • Using the DCL Definition Type
  • Using Platform Definition Types
  • Using the OS Native Definition Type
  • Microsoft Windows Definition Types
  • Using the SQLPLUS Definition Type
  • Using the FTP Definition Type
  • Using the Groovy Definition Type

Command Line Tools

  • Command Line System Tools
  • jtool
  • jcat
  • jdescription
  • jevent
  • jecho
  • jftp
  • JFTP Return Codes
  • jgetcredential
  • jgetfile
  • jgetpar
  • jjoin
  • jlink
  • jlog
  • jmail
  • jmessage
  • jmonitor
  • jputfile
  • jregister
  • jrfc
  • jscp
  • jtool screenshot
  • jscript
  • jsecret
  • jsleep
  • jsplit
  • api-tool.jar

OpenVMS Process Servers

  • Creating HP OpenVMS Process Servers
  • Installing the Platform Agent on HP OpenVMS
  • Configuring HP OpenVMS Process Servers
  • File Events on HP OpenVMS
  • HP OpenVMS Definition Types

AS/400 Connector

  • IBM AS/400 Connector Architecture
  • Setting up the IBM AS/400 Connector
  • Creating an IBM AS/400 Process Server
  • Files on AS/400 Raise Events
  • Using the AS/400 Definition Type
  • Redwood Server OS Support
  • IBM z/OS Definition Types
  • Using the JCL_FTP Definition Type
  • IBM z/OS System Tools

Reference

  • Balancing the Load
  • Credential Protocols
← Using the Visual Basic Script Definition TypeUsing the R Process Definition Type →

Using the CMD Definition Type

The Microsoft Windows Command CMD language is the Windows version of BAT (MS-DOS batch) files. It supports everything that BAT supported, and more. The CMD language is quite powerful nowadays; of particular interest when writing scripts are the SET, IF and FOR commands. Type HELP followed by a command in a command prompt for more information.

note

You must assign at least one process server to run CMD process definitions in order to use the definition type.

For commands that interact with COM or WMI commands it is better to use the VBScript or PowerShell definition types.

Variables and Parameters

  • Parameters to the process definition are manipulated in the CMD source simply as if they are variables, using the standard %PARAMETER% syntax.
  • The CMD language does not have actual data types; all parameter values are stored as strings. Numbers are translated automatically. Dates are sent and retrieved using the Script Date Format.
  • Out parameters are supported by setting the parameter using the set PARAMETER=VALUE syntax.

Exiting a Script

If processing of the CMD file ends by means of a hard EXIT [0] command (without /b switch), a warning will be printed in the output file and output variables will not be set. The correct ways to end the process without error and set the output variables are:

  • Running to the end of the process definition source.
  • Use GOTO :EOF (see HELP GOTO).
  • Use EXIT /B [0]

Returning an Error

If processing of the CMD file ends by means of a hard EXIT [<n>] command, where <n> is an integer greater than 0, (without /b switch), the process will reach status Error and output variables will not be set. The correct way to return an error and still set the output variables is EXIT /B <n>, where <n> is an integer greater than 0. The return code will be used as the Return Code of the process.

32/64-bit

By default, the 32-bit versions of the interpreters are used on Windows platforms, this can be changed using the following:

  • JCS_INTERPRETER_CMD - parameter used to override default, can be set to C:/Windows/Sysnative/cmd.exe for 64-bit; default when non-existent or empty and process server parameter LocalInterpreter_CMD not set: C:/Windows/System32/cmd.exe
  • InterpreterWhitelist_CMD - process server parameter that takes a regex expression matching all interpreters you want supported. Use.* to allow any or C:/Windows/.*/cmd.exe} to allow any cmd.exe in a subfolder of C:/Windows. You can also explicitly set two separated by a comma without space (regex syntax): C:/Windows/Sysnative/cmd.exe,C:/Windows/System32/cmd.exe
  • LocalInterpreter_CMD - process server parameter used to set default to 64-bit, can be set to C:/Windows/Sysnative/cmd.exe for 64-bit; affects all processes for the process server that do not have JCS_INTERPRETER_CMD set, default or when not set: C:/Windows/System32/cmd.exe
  • LocalInterpreterBits - Set this key to 64 and all Windows platform agents will use 64-Bit interpreters.
note

In Windows 64-bit, you have to explicitly call the 32-bit binaries to access C:/Windows/Sysnative; the path does not exist for 64-bit applications. Also, in 32-bit applications, C:/Windows/System32 is linked to C:/Windows/SYSWOW64 which contains the 32-bit windows binaries. Remember that on 64-bit Windows platforms the System32 directory contains 64-bit binaries and SYSWOW64 is the directory containing 32-bit binaries. In other words, the number of bits is the opposite of that in the directory name.

note

Always use forward slashes / as a Windows path separator in Redwood Server. Windows accepts them almost everywhere except in some legacy MS DOS-era executables that use the forward slash

Background and Foreground Processes

By default, commands are executed in the background; you will not see any dialog on the server console. If you want to display a process on-screen, you use the {session} or {console} keywords in the Run As User field followed by the credential or username and password.

  • {session} - the process runs in a RDP, Windows Terminal Server, or console session running as the account specified in the credential. If no such windows user session exists, the process will fail with status Error.
  • {console} - Console session, only; console sessions are displayed on the physical monitor screen attached to the server. If the user specified by the credential is not the user that is logged on to the console, the process will fail with status Error.

These two options are useful but they require dedicating a system to a particular account (via {console} ) or that some other means is used to ensure that a RDP session exists. It is usually better to let the platform agent manage RDP sessions via the built-in Windows Session support support.

note

Sessions are always for a user account; it is not possible to run session/console processes under NT Authority\LocalSystem.

Run As User Examples

Specifying a Run As User field with {session} and virtual user

{session}{virtual}:ops

Specifying a Run As User field with {console} and credential

{console}jdoe@example.corp

Examples

The following shows how to pass numeric (N1), string (S1) and date (D1) parameters to and from CMD scripts:

set /A N1=%N1% + %N1%
rem Concatenate string
set S1=%S1% %S1%
set DTEMP=1999/12/31 23:59:59,000 GMT"
echo You said %D1%, I propose %DTEMP%
rem Set DateTime to new string value
set D1=%DTEMP%

The following example shows you how to return a non-zero exit code resulting in the processes going into error:

set N=1
echo Exiting with value %N%.
if %N% GEQ 1 exit/b %N%

echo Not reached

The following shows how to obtain the number of free bytes on drive C on the process server that the process runs on:

rem
rem Find out how many bytes are free on drive C:, and set the DIRSPACE variable
rem accordingly. This depends on "dir" writing the drive space on its last line
rem of output. We continuously overwrite the same variable until we automatically
rem leave the last value in place.
rem

for /F "usebackq tokens=3" %%x in (`dir /-C c:\`) do call :getline %%x
goto :EOF

:getline
set DIRSPACE=%1
goto :EOF

The following shows how to detect if the 32-bit executable is used (This requires a hotfix for Windows 2003 kb942589.

if exist c:\windows\sysnative\cmd.exe (
    echo "32-bit"
) else (
    echo "64-bit"
)

See Also

  • Platform Agent Definition Types
  • Command Line System Tools
← Using the Visual Basic Script Definition TypeUsing the R Process Definition Type →
  • Variables and Parameters
  • Exiting a Script
  • Returning an Error
  • 32/64-bit
  • Background and Foreground Processes
    • Run As User Examples
  • Examples
  • See Also
Docs
Getting StartedInstallationFinance InstallationConcepts
TroubleshootingArchiving
Learn and Connect
Support Portal
BlogEventsResources
ISO/ IEC 27001 Information Security Management
Automate to be human

2023 All Rights Reserved |

Terms of Service | Policies | Cookies | Glossary | Third-party Software | Contact | Copyright | Impressum |