IF-ELSE-STEP CommandsThe following is a summary of IF-ELSE-STEP commands used in VSA agent procedures.
IF Commands Application is Running Checks to see if a specified application is currently running on the managed machine. If the application is running, the IF command is executed; otherwise, the ELSE command is executed. When this option is selected from the drop-down list, the Enter the application name field appears. Specify the process name for the application you want to test. For example, to test the Check Registry Value / Check 64-Bit Registry Value After entering the registry path, the value contained in the key is returned. A check can be made for existence, absence, equality, or size differences. For example, A backslash character The available tests are:
Check Variable Enter a variable name, in the form
For the tests Evaluate Expression Enter an expression containing one or more variable names, in the form
Service is Running Determines if a service is running on the managed machine. Specify the service name.
Test File Determines if a file exists on a managed machine. Enter the full path and file name. Test File compares the full path and file name with the supplied value. If the check is true, IF commands are executed. If the check is false, ELSE steps are executed. Note: Environment variables such as The available tests are:
Test File in Directory Path Tests the specified file located at the path returned using the Get Directory Path From Registry step. The available tests are:
Test Registry Key / Test 64-bit Register Key Tests for the existence of a registry key. Test Registry Key differs from Check Registry Value since it can check for a directory level registry entry that only contains more registry keys (no values). True Selecting User Is Logged In Tests to see if a specific user or any user is logged on the managed machine. Enter the machine user's logon name or leave the field blank to check for any user logged on. The IF commands are executed if a user is logged on. The ELSE steps are executed if the user is not logged on. User Response is Yes Displays a dialog box on the managed machine with Yes and No buttons. Also carries out the ELSE command if a specified amount of time has timed out. If Yes is selected by the machine user, the IF command is executed. If the selection times out or the machine user selects No, the ELSE command is executed. This function requests the machine user's permission to proceed with the agent procedure. This query is useful for agent procedures that require a reboot of the managed machine before completion. Procedure variables, for example STEP Commands Close Application If the specified application is running on the managed machine, then that application is closed down. Specify the process name for the application you want to close. For example, to close the Delete File Deletes a file on a managed machine. Enter the full path and filename. Note: Environment variables are acceptable if they are set on a user's machine. For example, using a path Note: You can delete a file that is currently in use using the Rename Locked File command. Delete File in Directory Path Deletes the specified file located at the path returned using the Get Directory Path From Registry command. Delete Registry Key / Delete 64-bit Registry Key Deletes the specified registry key and all its sub-keys. Delete Registry Value / Delete 64-bit Registry Value Deletes the value stored at the specified registry key. Execute File Executes the specified file on the managed machine. This function replicates launching an application using the Run… command located in the Microsoft Windows Start menu. This function takes three parameters:
If Execute as the logged on user is selected, then a credential must be specified by running either the Impersonate User or Use Credential command before this command. If run Execute as the system account is selected, execution is restricted to the agent's system level access. Execute File in Directory Path Same as Execute File except the location of the .exe file is located at the path returned from a Get Directory Path From Registry command. If Execute as the logged on user is selected, then a credential must be specified by running either the Impersonate User or Use Credential command before this command. If run Execute as the system account is selected, execution is restricted to the agent's system level access. Execute Procedure Causes another named procedure to execute. Use this capability to string multiple IF-ELSE-STEP procedures together. If the procedure no longer exists on the KServer, an error message displays next to the procedure drop-down list. You can use this command to run a system procedure. You can nest procedures to 10 levels. Execute Shell Command Allows the procedure to pass commands to the command interpreter on the managed machine. When this command is selected, the field Enter the command to execute in a command shell is displayed. Enter a command in the field. The command must be syntactically correct and executable with the OS version on the managed machine. Commands and parameters containing spaces should be surrounded by quotes. Since the command is executed relative to the agent directory, absolute paths should be used when entering commands. Note: Execute Shell Command opens a command prompt window on the managed machine to execute in. If you do not want a window opening on the managed machine, because it might confuse users, put all the commands in a batch file. Send that file to the managed machine using the Write File command. Then run the batch file with the Execute File command. Execute File does not open a window on the managed machine. If Execute as the logged on user is selected, then a credential must be specified by running either the Impersonate User or Use Credential command before this command. If run Execute as the system account is selected, execution is restricted to the agent's system level access. Get Directory Path From Registry Returns a file path stored in the specified registry key. Use this command to fetch the file location. For instance, use this command to find the directory where an application has been installed. The result can be used in subsequent steps by:
Get File Upload the file at the specified path from the managed machine. Be sure to enter a full path filename that you want to upload. Example:
Get File in Directory Path Just like the Get File command but it adds the path returned from the Get Directory Path From Registry command to the beginning of the remote file path. Access the uploaded file using the Agent Procedures > Get File function. Get URL Returns the text and HTML contents of a URL and stores it to a file on the managed machine. To demonstrate this to yourself, try specifying Another use is to download an executable file that is available from a web server, so that you don't need to upload the file to the VSA server nor use the VSA's bandwidth to write the file down to each agent. You can use a subsequent command to run the downloaded executable on the managed machine. Get Variable Defines a new agent variable. When the procedure step executes, the system defines a new variable and assigns it a value based on data fetched from the managed machine's agent. Note: See Using Variables for the types of variable values supported by the Get Variable command. Impersonate User Enter a username, password, and domain for the agent to logon with. This command is used in a procedure before an Execute File, Execute File in Directory Path or Execute Shell Command that specifies the Execute as the logged on user option. Leave the domain blank to log into an account on the local machine. Use Impersonate User to run an agent procedure using a credential specified by agent procedure. Use Use Credential to run an agent procedure using a credential specified by managed machine. Pause Procedure Pause the procedure for N seconds. Use this command to give Windows time to complete an asynchronous task, like starting or stopping a service. Reboot Unconditionally reboots the managed machine. To warn the user first, use the User Response is Yes command before this command. A User Response is Yes command prompts the user before rebooting their machine. Rename Locked File Renames a file that is currently in use. The file is renamed the next time the system is rebooted. The specified filename is a complete file path name. Can be used to delete a file that is currently in use if the "new file name" is left blank. The file is deleted when the system is rebooted. Rename Locked File in Directory Path Renames a file that is currently in use that is located in the path returned from a Get Directory Path From Registry command. The file is renamed the next time the system is rebooted. Can be used to delete a file that is currently in use if the "new file name" is left blank. The file is deleted when the system is rebooted. Schedule Procedure Schedules a procedure to run on a specified machine. Optionally specifies the time to wait after executing this step before running the procedure and the specified machine ID to run the procedure on. If no machine is specified, then the procedure is run on the same machine running the agent procedure. Enter the complete name of the machine, for example, Send Email Sends an email to one or more recipients. Specifies the subject and body text of the email. Send Message Sends the entered message to a managed machine. An additional checkbox, if checked, sends the message immediately. If unchecked, sends the message after the user clicks the flashing agent system tray icon. Send URL Displays the entered URL in a web browser window on the managed machine. An additional checkbox, if checked, displays the URL immediately. If unchecked, the URL is displayed after the user clicks the flashing agent system tray icon. Set Registry Value / Set 64-bit Registry Value Writes data to the specified registry value. This function takes three parameters:
Update System Info Updates the selected System Info field with the specified value for the machine ID this procedure runs on. The System Info fields you can update include all columns in vSystemInfo except Use Credential Uses the credentials set for the machine ID in Set Credential. This command is used in a procedure before an Execute File, Execute File in Directory Path or Execute Shell Command that specifies the Execute as the logged on user option. Also used to access a network resource requiring a credential from a machine when a user is not logged on. Use Impersonate User to run an agent procedure using a credential specified by agent procedure. Use Use Credential to run an agent procedure using a credential specified by managed machine. Note: A procedure execution error is logged if a Set Credential procedure command encounters an empty username. Note: Patch Management > Patch Alert can alert you—or run an agent procedure—if a machine ID's credential is missing or invalid. Write Directory Writes a selected directory, including subdirectories and files, from Manage Files Stored on Server to the full path directory name specified on the managed machine. Write File Writes a file selected from Manage Files Stored on Server to the full path filename specified on the managed machine. Enter a new filename if you want the file to be renamed. Each time a procedure executes the Write File command, the agent checks to see if the file is already there or not by hashing the file to verify integrity. If not, the file is written. If the file is already there, the procedure moves to the next step. You can repeatedly run a procedure with Write File that sends a large file to a managed machine and know that the VSA only downloads that file once. Note: Environment variables are acceptable if they are set on a user's machine. For example, using the path Write File in Directory Path Writes the specified filename to the path returned from a Get Directory Path From Registry command. Write Procedure Log Entry Writes the supplied string to the Agent Procedure Log for the machine ID executing this agent procedure. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Topic 674: Send Feedback. Download a PDF of this online book from the first topic in the table of contents. Print this topic. |