The documentation set for this product strives to use bias-free language. For the purposes of this documentation set, bias-free is defined as language that does not imply discrimination based on age, disability, gender, racial identity, ethnic identity, sexual orientation, socioeconomic status, and intersectionality. Exceptions may be present in the documentation due to language that is hardcoded in the user interfaces of the product software, language used based on RFP documentation, or language that is used by a referenced third-party product. Learn more about how Cisco is using Inclusive Language.
This chapter contains the following sections:
You execute commands on guest VMs using the Guest Operations task available from the Cisco UCS Director task library. The Guest Operations task allows you to perform guest OS operations by running commands. The Guest Operations task supports rollback and the option to capture command output and error codes.
You can execute commands on Windows guest VMs through either PowerShell, a batch script, or the command prompt.
Note | When you select a VM in the Guest Operations task, the OS type is automatically selected. You do not need to change the OS type. |
The Guest Operations task has the same functionality as the existing Execute VIX Script task. In addition, the Guest Operations task supports:
The option to upload a zip file to the Guest OS
The option to upload and execute a zip file on the Guest OS
Note | The uploaded zip file may contain one or more files to execute on the Guest OS. |
The Guest Operations task extracts the zip file in a temporary location on Cisco UCS Director. For example, the files are extracted to /opt/infra/uploads/permanent/admin/1492532488911 where admin is the system admin login name for Cisco UCS Director.
To run PowerShell commands, provide the following in the Executable Path and Options field in the Guest Operations task:
The path of PowerShell.exe and options, such as c:\Windows\System32\windowspowershell\v1.0\powershell.exe
To run commands or batch script commands through the command prompt, provide the following in the Guest Operations task:
The following examples illustrate how you can execute Linux or Windows commands on a VM using the Guest Operations task.
In this example, we execute a single-line Windows command using the Guest Operations task.
Enter the following information in the Guest Operations task available on the Cisco UCS Director appliance:
Select the VM where you want to run the Windows batch script.
Enter the administrator credentials of the VM.
From the OS Type drop-down list, choose Windows.
In the Executable Path and Options field, enter the following sample Windows command:
C:\\WINDOWS\\system32\\cmd.exe /c
In the Command Path field, enter the following sample command path:
mkdir C:\\test_Dir_1234
After executing the task, you see the following information in the log:
Service Request ID: 1275 Jan 23, 2017 06:27:43 UTC Request submitted Jan 23, 2017 06:27:43 UTC Executing workflow item number 1 Jan 23, 2017 06:27:43 UTC Completed workflow item number 1, with status Completed Jan 23, 2017 06:27:47 UTC Executing workflow item number 2 Jan 23, 2017 06:27:47 UTC Trigger context executeWorkFlowStep called Jan 23, 2017 06:27:47 UTC Executing custom action GO_Windows_Select_Batch (VMware Guest Operations) Jan 23, 2017 06:27:47 UTC Executing custom action GO_Windows_Select_Batch (VMware Guest Operations) Jan 23, 2017 06:27:47 UTC Started executing command on guest VIXTest_DND_2012 Jan 23, 2017 06:27:54 UTC Completed executing command Jan 23, 2017 06:27:54 UTC Task #2 (GO_Windows_Select_Batch (VMware Guest Operations)) completed successfully in 6 seconds Jan 23, 2017 06:27:54 UTC Input/Output values for Task #2 (GO_Windows_Select_Batch (VMware Guest Operations)): Jan 23, 2017 06:27:54 UTC [Local Input: Select VM = 16483] Jan 23, 2017 06:27:54 UTC [Local Input: User Name = Administrator] Jan 23, 2017 06:27:54 UTC [Local Input: Password = **masked-value**] Jan 23, 2017 06:27:54 UTC [Local Input: OS Type = windows] Jan 23, 2017 06:27:54 UTC [Local Input: Guest Operations = executeCommand] Jan 23, 2017 06:27:54 UTC [Local Input: = null] Jan 23, 2017 06:27:54 UTC [Local Input: Guest File Path = null] Jan 23, 2017 06:27:54 UTC [Local Input: Executor Path and Arguments = C:\\WINDOWS\\system32\\cmd.exe /c] Jan 23, 2017 06:27:54 UTC [Local Input: Command Path = mkdir C:\\test_Dir_1234] Jan 23, 2017 06:27:54 UTC [Local Input: Undo Script = ] Jan 23, 2017 06:27:54 UTC [Local Input: Error Codes = ] Jan 23, 2017 06:27:54 UTC [Output: EXIT_STATUS_CODE = 0] Jan 23, 2017 06:27:54 UTC [Output: COMMAND_OUTPUT = ] Jan 23, 2017 06:27:54 UTC Completed workflow item number 2, with status Completed Jan 23, 2017 06:27:59 UTC Executing workflow item number 3 Jan 23, 2017 06:27:59 UTC Completed workflow item number 3, with status Completed
As seen in the log, the command is executed directly on the VM.
In this example, we execute a multiline Windows command using the Guest Operations task.
Enter the following information in the Guest Operations task available on the Cisco UCS Director appliance:
Select the VM where you want to run the Windows batch script.
Enter the administrator credentials of the VM.
From the OS Type drop-down list, choose Windows.
In the Executable Path and Options field, enter the following sample Windows command:
C:\\WINDOWS\\system32\\cmd.exe /c
In the Command Path field, enter the following sample command path:
echo 1st file > C:\\One.txt && echo 2nd file > C:\\Two.txt
After executing the task, you see the following information in the log:
Service Request ID: 1328 Feb 01, 2017 06:15:17 UTC Request submitted Feb 01, 2017 06:15:20 UTC Executing workflow item number 1 Feb 01, 2017 06:15:20 UTC Completed workflow item number 1, with status Completed Feb 01, 2017 06:15:26 UTC Executing workflow item number 2 Feb 01, 2017 06:15:26 UTC Trigger context executeWorkFlowStep called Feb 01, 2017 06:15:26 UTC Executing custom action Guest Operations testing (VMware Guest Operations) Feb 01, 2017 06:15:26 UTC Executing custom action Guest Operations testing (VMware Guest Operations) Feb 01, 2017 06:15:27 UTC Started executing command on guest VIXTest_DND_2012 Feb 01, 2017 06:15:33 UTC Completed executing command Feb 01, 2017 06:15:33 UTC Task #2 (Guest Operations testing (VMware Guest Operations)) completed successfully in 6 seconds Feb 01, 2017 06:15:33 UTC Input/Output values for Task #2 (Guest Operations testing (VMware Guest Operations)): Feb 01, 2017 06:15:33 UTC [Local Input: Select VM = 16483] Feb 01, 2017 06:15:33 UTC [Local Input: User Name = Administrator] Feb 01, 2017 06:15:33 UTC [Local Input: Password = **masked-value**] Feb 01, 2017 06:15:33 UTC [Local Input: OS Type = windows] Feb 01, 2017 06:15:33 UTC [Local Input: Guest Operations = executeCommand] Feb 01, 2017 06:15:33 UTC [Local Input: Upload File = null] Feb 01, 2017 06:15:33 UTC [Local Input: Guest File Path = null] Feb 01, 2017 06:15:33 UTC [Local Input: Executor Path and Options = C:\Windows\System32\cmd.exe /c] Feb 01, 2017 06:15:33 UTC [Local Input: Command Path = echo 1st file > c:\\One.txt && echo 2nd file > c:\\Two.txt] Feb 01, 2017 06:15:33 UTC [Local Input: Undo Script = ] Feb 01, 2017 06:15:33 UTC [Local Input: Error Codes = ] Feb 01, 2017 06:15:33 UTC [Output: EXIT_STATUS_CODE = 0] Feb 01, 2017 06:15:33 UTC [Output: COMMAND_OUTPUT = ] Feb 01, 2017 06:15:33 UTC Completed workflow item number 2, with status Completed Feb 01, 2017 06:15:38 UTC Executing workflow item number 3 Feb 01, 2017 06:15:38 UTC Completed workflow item number 3, with status Completed
As seen in the log, the command is executed directly on the VM.
In this example, we execute a single-line Linux command using the Guest Operations task.
Enter the following information in the Guest Operations task available on the Cisco UCS Director appliance:
Select the VM where you want to run the Linux command.
Enter the administrator credentials of the VM.
From the OS Type drop-down list, choose Linux.
In the Command Path field, enter the following sample Linux command:
/bin/mkdir /tmp/testdir1
After executing the task, you see the following information in the log:
Service Request ID: 1272 Jan 23, 2017 06:17:45 UTC Request submitted Jan 23, 2017 06:17:47 UTC Executing workflow item number 1 Jan 23, 2017 06:17:47 UTC Completed workflow item number 1, with status Completed Jan 23, 2017 06:17:53 UTC Executing workflow item number 2 Jan 23, 2017 06:17:53 UTC Trigger context executeWorkFlowStep called Jan 23, 2017 06:17:53 UTC Executing custom action GO_Linux_Select (VMware Guest Operations) Jan 23, 2017 06:17:53 UTC Executing custom action GO_Linux_Select (VMware Guest Operations) Jan 23, 2017 06:17:54 UTC Started executing command on guest VIXTest_DND_CentOS_Auto_prs Jan 23, 2017 06:17:59 UTC Completed executing command Jan 23, 2017 06:18:00 UTC Task #2 (GO_Linux_Select (VMware Guest Operations)) completed successfully in 6 seconds Jan 23, 2017 06:18:00 UTC Input/Output values for Task #2 (GO_Linux_Select (VMware Guest Operations)): Jan 23, 2017 06:18:00 UTC [Local Input: Select VM = 16460] Jan 23, 2017 06:18:00 UTC [Local Input: User Name = root] Jan 23, 2017 06:18:00 UTC [Local Input: Password = **masked-value**] Jan 23, 2017 06:18:00 UTC [Local Input: OS Type = linux] Jan 23, 2017 06:18:00 UTC [Local Input: Guest Operations = executeCommand] Jan 23, 2017 06:18:00 UTC [Local Input: = null] Jan 23, 2017 06:18:00 UTC [Local Input: Guest File Path = null] Jan 23, 2017 06:18:00 UTC [Local Input: Executor Path and Arguments = null] Jan 23, 2017 06:18:00 UTC [Local Input: Command Path = /bin/mkdir /tmp/testdir1] Jan 23, 2017 06:18:00 UTC [Local Input: Undo Script = /bin/rmdir /tmp/testdir1] Jan 23, 2017 06:18:00 UTC [Local Input: Error Codes = ] Jan 23, 2017 06:18:00 UTC [Output: EXIT_STATUS_CODE = 0] Jan 23, 2017 06:18:00 UTC [Output: COMMAND_OUTPUT = ] Jan 23, 2017 06:18:00 UTC Completed workflow item number 2, with status Completed Jan 23, 2017 06:18:02 UTC Executing workflow item number 3 Jan 23, 2017 06:18:02 UTC Completed workflow item number 3, with status Completed
As seen in the log, the command is executed directly on the VM.
In this example, we execute a single-line Windows command at PowerShell by using the Guest Operations task. To execute a command at PowerShell, provide the path of PowerShell and the command.
Enter the following information in the Guest Operations task available on the Cisco UCS Director appliance:
Select the VM where you want to run the Windows command.
Enter the administrator credentials of the VM.
From the OS Type drop-down list, choose Windows.
In the Executable Path and Options field, enter the path of PowerShell:
C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\PowerShell.exe
In the Command Path field, enter the following sample command path:
mkdir C:\\test_Dir_1234
After executing the task, you see the following information in the log:
Service Request ID: 1277 Jan 23, 2017 06:32:27 UTC Request submitted Jan 23, 2017 06:32:32 UTC Executing workflow item number 1 Jan 23, 2017 06:32:32 UTC Completed workflow item number 1, with status Completed Jan 23, 2017 06:32:35 UTC Executing workflow item number 2 Jan 23, 2017 06:32:35 UTC Trigger context executeWorkFlowStep called Jan 23, 2017 06:32:35 UTC Executing custom action GO_Windows_Select_PowerShell (VMware Guest Operations) Jan 23, 2017 06:32:35 UTC Executing custom action GO_Windows_Select_PowerShell (VMware Guest Operations) Jan 23, 2017 06:32:35 UTC Started executing command on guest VIXTest_DND_2012 Jan 23, 2017 06:32:41 UTC Completed executing command Jan 23, 2017 06:32:42 UTC Task #2 (GO_Windows_Select_PowerShell (VMware Guest Operations)) completed successfully in 6 seconds Jan 23, 2017 06:32:42 UTC Input/Output values for Task #2 (GO_Windows_Select_PowerShell (VMware Guest Operations)): Jan 23, 2017 06:32:42 UTC [Local Input: Select VM = 16483] Jan 23, 2017 06:32:42 UTC [Local Input: User Name = Administrator] Jan 23, 2017 06:32:42 UTC [Local Input: Password = **masked-value**] Jan 23, 2017 06:32:42 UTC [Local Input: OS Type = windows] Jan 23, 2017 06:32:42 UTC [Local Input: Guest Operations = executeCommand] Jan 23, 2017 06:32:42 UTC [Local Input: = null] Jan 23, 2017 06:32:42 UTC [Local Input: Guest File Path = null] Jan 23, 2017 06:32:42 UTC [Local Input: Executor Path and Arguments = C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\PowerShell.exe] Jan 23, 2017 06:32:42 UTC [Local Input: Command Path = mkdir C:\\test_Dir_1234] Jan 23, 2017 06:32:42 UTC [Local Input: Undo Script = ] Jan 23, 2017 06:32:42 UTC [Local Input: Error Codes = ] Jan 23, 2017 06:32:42 UTC [Output: COMMAND_OUTPUT = Directory: C:\Mode LastWriteTime Length Name ---- ------------- ------ ---- d---- 1/22/2017 10:32 PM test_Dir_1234] Jan 23, 2017 06:32:42 UTC [Output: EXIT_STATUS_CODE = 0] Jan 23, 2017 06:32:42 UTC Completed workflow item number 2, with status Completed Jan 23, 2017 06:32:44 UTC Executing workflow item number 3 Jan 23, 2017 06:32:44 UTC Completed workflow item number 3, with status Completed
As seen in the log, the command is executed directly on the VM.
In this example, we execute a multiline Windows command at PowerShell by using the Guest Operations task. To execute a command at PowerShell, provide the path of PowerShell and the command.
Enter the following information in the Guest Operations task available on the Cisco UCS Director appliance:
Select the VM where you want to run the Windows command.
Enter the administrator credentials of the VM.
From the OS Type drop-down list, choose Windows.
In the Executable Path and Options field, enter the path of PowerShell:
C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\PowerShell.exe
In the Command Path field, enter the following sample command path:
echo 1st file > C:\\One.txt echo 2nd file > C:\\Two.txt
After executing the task, you see the following information in the log:
Service Request ID: 1329 Feb 01, 2017 06:23:20 UTC Request submitted Feb 01, 2017 06:23:21 UTC Executing workflow item number 1 Feb 01, 2017 06:23:21 UTC Completed workflow item number 1, with status Completed Feb 01, 2017 06:23:24 UTC Executing workflow item number 2 Feb 01, 2017 06:23:24 UTC Trigger context executeWorkFlowStep called Feb 01, 2017 06:23:24 UTC Executing custom action Guest Operations testing (VMware Guest Operations) Feb 01, 2017 06:23:24 UTC Executing custom action Guest Operations testing (VMware Guest Operations) Feb 01, 2017 06:23:25 UTC Started executing command on guest VIXTest_DND_2012 Feb 01, 2017 06:23:31 UTC Completed executing command Feb 01, 2017 06:23:31 UTC Task #2 (Guest Operations testing (VMware Guest Operations)) completed successfully in 6 seconds Feb 01, 2017 06:23:31 UTC Input/Output values for Task #2 (Guest Operations testing (VMware Guest Operations)): Feb 01, 2017 06:23:31 UTC [Local Input: Select VM = 16483] Feb 01, 2017 06:23:31 UTC [Local Input: User Name = Administrator] Feb 01, 2017 06:23:31 UTC [Local Input: Password = **masked-value**] Feb 01, 2017 06:23:31 UTC [Local Input: OS Type = windows] Feb 01, 2017 06:23:31 UTC [Local Input: Guest Operations = executeCommand] Feb 01, 2017 06:23:31 UTC [Local Input: Upload File = null] Feb 01, 2017 06:23:31 UTC [Local Input: Guest File Path = null] Feb 01, 2017 06:23:31 UTC [Local Input: Executor Path and Options = C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\PowerShell.exe] Feb 01, 2017 06:23:31 UTC [Local Input: Command Path = echo 1st file > C:\\One.txt echo 2nd file > C:\\Two.txt] Feb 01, 2017 06:23:31 UTC [Local Input: Undo Script = ] Feb 01, 2017 06:23:31 UTC [Local Input: Error Codes = ] Feb 01, 2017 06:23:31 UTC [Output: EXIT_STATUS_CODE = 0] Feb 01, 2017 06:23:31 UTC Completed workflow item number 2, with status Completed Feb 01, 2017 06:23:36 UTC Executing workflow item number 3 Feb 01, 2017 06:23:36 UTC Completed workflow item number 3, with status Completed
As seen in the log, the command is executed directly on the VM.
The Guest Operations task provides the option to upload a zipped batch script file or a zipped PowerShell script file to a Windows or Linux guest VM. If you select the Upload File to Guest option, you must choose the zip file and specify the path or directory on the guest VM to which you want to upload the zip file. The uploaded zip file may contain one or more files to execute on the Guest OS.
The Guest Operations task extracts the zip file in a temporary location on Cisco UCS Director. For example, the files are extracted to /opt/infra/uploads/admin/1488281478583 where admin is the system admin login name for Cisco UCS Director.
Note | To upload a zip file, you must have at least two times the file size available in Cisco UCS Director disk space. |
In this example, we upload a zip file to a Windows Guest VM by using the Guest Operations task.
Enter the following information in the Guest Operations task available on the Cisco UCS Director appliance:
Select the VM where you want to upload a zip file.
Enter the administrator credentials of the VM.
From the OS Type drop-down list, choose Windows.
From the Guest Operations drop-down list, choose Upload File to Guest.
In the File field, drag and drop the zip file you want to upload, or click Select a File to choose the zip file you want to upload.
In the Guest OS Folder Path field, enter the path on Windows guest VM to which you want to upload the zip file:
C:\FileUpload\
After executing the task, you see the following information in the log:
Service Request ID: 1282 Jan 23, 2017 07:01:28 UTC Request submitted Jan 23, 2017 07:01:29 UTC Executing workflow item number 1 Jan 23, 2017 07:01:29 UTC Completed workflow item number 1, with status Completed Jan 23, 2017 07:01:35 UTC Executing workflow item number 2 Jan 23, 2017 07:01:35 UTC Trigger context executeWorkFlowStep called Jan 23, 2017 07:01:35 UTC Executing custom action GO_Windows_Upload (VMware Guest Operations) Jan 23, 2017 07:01:35 UTC Executing custom action GO_Windows_Upload (VMware Guest Operations) Jan 23, 2017 07:01:35 UTC Started uploading file to guest VIXTest_DND_2012 Jan 23, 2017 07:01:36 UTC Completed file uploading Jan 23, 2017 07:01:36 UTC Task #2 (GO_Windows_Upload (VMware Guest Operations)) completed successfully in 0 seconds Jan 23, 2017 07:01:36 UTC Input/Output values for Task #2 (GO_Windows_Upload (VMware Guest Operations)): Jan 23, 2017 07:01:36 UTC [Local Input: Select VM = 16483] Jan 23, 2017 07:01:36 UTC [Local Input: User Name = Administrator] Jan 23, 2017 07:01:36 UTC [Local Input: Password = **masked-value**] Jan 23, 2017 07:01:36 UTC [Local Input: OS Type = windows] Jan 23, 2017 07:01:36 UTC [Local Input: Guest Operations = uploadFiletoGuest] Jan 23, 2017 07:01:36 UTC [Local Input: = sample.zip] Jan 23, 2017 07:01:36 UTC [Local Input: Guest OS Folder Path = C:\FileUpload\] Jan 23, 2017 07:01:36 UTC [Local Input: Executor Path and Arguments = null] Jan 23, 2017 07:01:36 UTC [Local Input: Command Path = null] Jan 23, 2017 07:01:36 UTC [Local Input: Undo Script = ] Jan 23, 2017 07:01:36 UTC [Local Input: Error Codes = ] Jan 23, 2017 07:01:36 UTC Completed workflow item number 2, with status Completed Jan 23, 2017 07:01:38 UTC Executing workflow item number 3 Jan 23, 2017 07:01:38 UTC Completed workflow item number 3, with status Completed
As seen in the log, the command is executed directly on the VM.
In this example, we upload a zip file to a Linux Guest VM by using the Guest Operations task.
Enter the following information in the Guest Operations task available on the Cisco UCS Director appliance:
Select the VM where you want to upload a zip file.
Enter the administrator credentials of the VM.
From the OS Type drop-down list, choose Linux.
From the Guest Operations drop-down list, choose Upload File to Guest.
In the File field, drag and drop the zip file you want to upload, or click Select a File to choose the zip file you want to upload.
In the Guest OS Folder Path field, enter the path on the Linux guest VM to which you want to upload the zip file:
/tmp/FileUpload/
After executing the task, you see the following information in the log:
Service Request ID: 1280 Jan 23, 2017 06:44:57 UTC Request submitted Jan 23, 2017 06:44:59 UTC Executing workflow item number 1 Jan 23, 2017 06:44:59 UTC Completed workflow item number 1, with status Completed Jan 23, 2017 06:45:02 UTC Executing workflow item number 2 Jan 23, 2017 06:45:02 UTC Trigger context executeWorkFlowStep called Jan 23, 2017 06:45:02 UTC Executing custom action GO_Linux_Upload (VMware Guest Operations) Jan 23, 2017 06:45:02 UTC Executing custom action GO_Linux_Upload (VMware Guest Operations) Jan 23, 2017 06:45:02 UTC Started uploading file to guest VIXTest_DND_CentOS Jan 23, 2017 06:45:08 UTC Completed file uploading Jan 23, 2017 06:45:08 UTC Task #2 (GO_Linux_Upload (VMware Guest Operations)) completed successfully in 5 seconds Jan 23, 2017 06:45:08 UTC Input/Output values for Task #2 (GO_Linux_Upload (VMware Guest Operations)): Jan 23, 2017 06:45:08 UTC [Local Input: Select VM = 16485] Jan 23, 2017 06:45:08 UTC [Local Input: User Name = root] Jan 23, 2017 06:45:08 UTC [Local Input: Password = **masked-value**] Jan 23, 2017 06:45:08 UTC [Local Input: OS Type = linux] Jan 23, 2017 06:45:08 UTC [Local Input: Guest Operations = uploadFiletoGuest] Jan 23, 2017 06:45:08 UTC [Local Input: = test.zip] Jan 23, 2017 06:45:08 UTC [Local Input: Guest OS Folder Path = /tmp/FileUpload/] Jan 23, 2017 06:45:08 UTC [Local Input: Executor Path and Arguments = null] Jan 23, 2017 06:45:08 UTC [Local Input: Command Path = null] Jan 23, 2017 06:45:08 UTC [Local Input: Undo Script = ] Jan 23, 2017 06:45:08 UTC [Local Input: Error Codes = ] Jan 23, 2017 06:45:08 UTC Completed workflow item number 2, with status Completed Jan 23, 2017 06:45:08 UTC Executing workflow item number 3 Jan 23, 2017 06:45:08 UTC Completed workflow item number 3, with status Completed
As seen in the log, the command is executed directly on the VM.
The Guest Operations task provides the option to execute an uploaded zipped batch script file or zipped PowerShell script file to a Windows or Linux guest VM. The uploaded zip file may contain one or more files to execute on the Guest OS.
Note | To upload a zip file, you must have at least two times the file size available in Cisco UCS Director disk space. |
The Guest Operations task extracts the zip file in a temporary location on Cisco UCS Director. For example, the files are extracted to /opt/infra/uploads/admin/1488281478583 where admin is the system admin login name for Cisco UCS Director.
If you select the Execute Uploaded File option, you must specify the following:
The file path on the guest VM to which you want to upload a single file that is zipped, or the directory on the guest VM to which you want to upload multiple files that are zipped
The executor path and options (for Windows guest VMs)
The command path
In this example, we upload and execute a batch script file on a Windows guest VM using the Guest Operations task.
Enter the following information in the Guest Operations task available on the Cisco UCS Director appliance:
Select the VM where you want to upload and exeute the Windows batch script.
Enter the administrator credentials of the VM.
From the OS Type drop-down list, choose Windows.
From the Guest Operations drop-down list, choose Upload and Execute File.
In the File field, drag and drop the zip file you want to upload, or click Select a File to choose the zip file you want to upload.
In the Guest OS Folder Path field, enter the path on Windows guest VM to which you want to upload the batch script file:
C:\FileUpload\
In the Executable Path and Options field, enter the following sample Windows command:
C:\WINDOWS\system32\cmd.exe /c
In the Command Path field, enter the following sample command path:
CALL C:\FileUpload\Sample.bat
After executing the task, you see the following information in the log:
Service Request ID: 1294 Jan 23, 2017 07:50:20 UTC Request submitted Jan 23, 2017 07:50:21 UTC Executing workflow item number 1 Jan 23, 2017 07:50:21 UTC Completed workflow item number 1, with status Completed Jan 23, 2017 07:50:24 UTC Executing workflow item number 2 Jan 23, 2017 07:50:24 UTC Trigger context executeWorkFlowStep called Jan 23, 2017 07:50:24 UTC Executing custom action GO_ExecuteUploadedFile_Batch (VMware Guest Operations) Jan 23, 2017 07:50:24 UTC Executing custom action GO_ExecuteUploadedFile_Batch (VMware Guest Operations) Jan 23, 2017 07:50:25 UTC Started uploading file to guest VIXTest_DND_2012 Jan 23, 2017 07:50:25 UTC Completed file uploading Jan 23, 2017 07:50:25 UTC Started executing command on guest VIXTest_DND_2012 Jan 23, 2017 07:50:31 UTC Completed executing command Jan 23, 2017 07:50:31 UTC Task #2 (GO_ExecuteUploadedFile_Batch (VMware Guest Operations)) completed successfully in 6 seconds Jan 23, 2017 07:50:31 UTC Input/Output values for Task #2 (GO_ExecuteUploadedFile_Batch (VMware Guest Operations)): Jan 23, 2017 07:50:31 UTC [Local Input: Select VM = 16483] Jan 23, 2017 07:50:31 UTC [Local Input: User Name = Administrator] Jan 23, 2017 07:50:31 UTC [Local Input: Password = **masked-value**] Jan 23, 2017 07:50:31 UTC [Local Input: OS Type = windows] Jan 23, 2017 07:50:31 UTC [Local Input: Guest Operations = executeUploadedFile] Jan 23, 2017 07:50:31 UTC [Local Input: = Sample.zip] Jan 23, 2017 07:50:31 UTC [Local Input: Guest OS Folder Path = C:\FileUpload\] Jan 23, 2017 07:50:31 UTC [Local Input: Executor Path and Arguments = C:\Windows\System32\cmd.exe /c] Jan 23, 2017 07:50:31 UTC [Local Input: Command Path = CALL C:\FileUpload\Sample.bat] Jan 23, 2017 07:50:31 UTC [Local Input: Undo Script = null] Jan 23, 2017 07:50:31 UTC [Local Input: Error Codes = ] Jan 23, 2017 07:50:31 UTC [Output: EXIT_STATUS_CODE = 0] Jan 23, 2017 07:50:31 UTC [Output: COMMAND_OUTPUT = ] Jan 23, 2017 07:50:31 UTC Completed workflow item number 2, with status Completed Jan 23, 2017 07:50:36 UTC Executing workflow item number 3 Jan 23, 2017 07:50:36 UTC Completed workflow item number 3, with status Completed
As seen in the log, the command is executed directly on the VM.
In this example, we upload and execute a PowerShell script file on a Windows guest VM using the Guest Operations task. To execute a command at PowerShell, provide the path of PowerShell and the command.
Enter the following information in the Guest Operations task available on the Cisco UCS Director appliance:
Select the VM where you want to upload and execute the Windows PowerShell script.
Enter the administrator credentials of the VM.
From the OS Type drop-down list, choose Windows.
From the Guest Operations drop-down list, choose Upload and Execute File.
In the File field, drag and drop the zip file you want to upload, or click Select a File to choose the zip file you want to upload.
In the Guest OS Folder Path field, enter the path on Windows guest VM to which you want to upload the PowerShell script file:
C:\FileUpload\
In the Executable Path and Options field, enter the following sample Windows command:
C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\PowerShell.exe
In the Command Path field, enter the following sample command path:
Invoke-Expression C:\FileUpload\sample.ps1
After executing the task, you see the following information in the log:
Service Request ID: 1295 Jan 23, 2017 07:56:51 UTC Request submitted Jan 23, 2017 07:56:57 UTC Executing workflow item number 1 Jan 23, 2017 07:56:57 UTC Completed workflow item number 1, with status Completed Jan 23, 2017 07:57:00 UTC Executing workflow item number 2 Jan 23, 2017 07:57:00 UTC Trigger context executeWorkFlowStep called Jan 23, 2017 07:57:00 UTC Executing custom action GO_ExecuteUploadedFile_PowerShell (VMware Guest Operations) Jan 23, 2017 07:57:00 UTC Executing custom action GO_ExecuteUploadedFile_PowerShell (VMware Guest Operations) Jan 23, 2017 07:57:01 UTC Started uploading file to guest VIXTest_DND_2012 Jan 23, 2017 07:57:01 UTC Completed file uploading Jan 23, 2017 07:57:01 UTC Started executing command on guest VIXTest_DND_2012 Jan 23, 2017 07:57:07 UTC Completed executing command Jan 23, 2017 07:57:08 UTC Task #2 (GO_ExecuteUploadedFile_PowerShell (VMware Guest Operations)) completed successfully in 7 seconds Jan 23, 2017 07:57:08 UTC Input/Output values for Task #2 (GO_ExecuteUploadedFile_PowerShell (VMware Guest Operations)): Jan 23, 2017 07:57:08 UTC [Local Input: Select VM = 16483] Jan 23, 2017 07:57:08 UTC [Local Input: User Name = Administrator] Jan 23, 2017 07:57:08 UTC [Local Input: Password = **masked-value**] Jan 23, 2017 07:57:08 UTC [Local Input: OS Type = windows] Jan 23, 2017 07:57:08 UTC [Local Input: Guest Operations = executeUploadedFile] Jan 23, 2017 07:57:08 UTC [Local Input: = sample.zip] Jan 23, 2017 07:57:08 UTC [Local Input: Guest OS Folder Path = C:\FileUpload\] Jan 23, 2017 07:57:08 UTC [Local Input: Executor Path and Arguments = C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\PowerShell.exe] Jan 23, 2017 07:57:08 UTC [Local Input: Command Path = Invoke-Expression C:\FileUpload\sample.ps1] Jan 23, 2017 07:57:08 UTC [Local Input: Undo Script = null] Jan 23, 2017 07:57:08 UTC [Local Input: Error Codes = ] Jan 23, 2017 07:57:08 UTC [Output: COMMAND_OUTPUT = Directory: C:\Mode LastWriteTime Length Name ---- ------------- ------ ---- d---- 1/22/2017 11:56 PM testWinPSAPI] Jan 23, 2017 07:57:08 UTC [Output: EXIT_STATUS_CODE = 0] Jan 23, 2017 07:57:08 UTC Completed workflow item number 2, with status Completed Jan 23, 2017 07:57:09 UTC Executing workflow item number 3 Jan 23, 2017 07:57:09 UTC Completed workflow item number 3, with status Completed
As seen in the log, the command is executed directly on the VM.
In this example, we upload and execute a file on a Linux guest VM using the Guest Operations task.
Enter the following information in the Guest Operations task available on the Cisco UCS Director appliance:
Select the VM where you want to run the upload and execute a Linux file.
Enter the administrator credentials of the VM.
From the OS Type drop-down list, choose Linux.
From the Guest Operations drop-down list, choose Upload and Execute File.
In the File field, drag and drop the zip file you want to upload, or click Select a File to choose the zip file you want to upload.
In the Guest OS Folder Path field, enter the path on Linux guest VM to which you want to upload the file:
/tmp/FileUpload/
In the Command Path field, enter the following sample command path:
/bin/sh /tmp/FileUpload/test.sh
After executing the task, you see the following information in the log:
Service Request ID: 1327 Feb 01, 2017 06:05:30 UTC Request submitted Feb 01, 2017 06:05:32 UTC Executing workflow item number 1 Feb 01, 2017 06:05:32 UTC Completed workflow item number 1, with status Completed Feb 01, 2017 06:05:38 UTC Executing workflow item number 2 Feb 01, 2017 06:05:38 UTC Trigger context executeWorkFlowStep called Feb 01, 2017 06:05:38 UTC Executing custom action GO_Linux_ExecuteUploadedFile (VMware Guest Operations) Feb 01, 2017 06:05:38 UTC Executing custom action GO_Linux_ExecuteUploadedFile (VMware Guest Operations) Feb 01, 2017 06:05:38 UTC Started uploading file to guest VIXTest_DND_CentOS Feb 01, 2017 06:05:44 UTC Completed file uploading Feb 01, 2017 06:05:44 UTC Started executing command on guest VIXTest_DND_CentOS Feb 01, 2017 06:05:50 UTC Completed executing command Feb 01, 2017 06:05:50 UTC Task #2 (GO_Linux_ExecuteUploadedFile (VMware Guest Operations)) completed successfully in 11 seconds Feb 01, 2017 06:05:50 UTC Input/Output values for Task #2 (GO_Linux_ExecuteUploadedFile (VMware Guest Operations)): Feb 01, 2017 06:05:50 UTC [Local Input: Select VM = 16485] Feb 01, 2017 06:05:50 UTC [Local Input: User Name = root] Feb 01, 2017 06:05:50 UTC [Local Input: Password = **masked-value**] Feb 01, 2017 06:05:50 UTC [Local Input: OS Type = linux] Feb 01, 2017 06:05:50 UTC [Local Input: Guest Operations = executeUploadedFile] Feb 01, 2017 06:05:50 UTC [Local Input: Upload File = test.zip] Feb 01, 2017 06:05:50 UTC [Local Input: Guest OS Folder Path = /tmp/FileUpload/] Feb 01, 2017 06:05:50 UTC [Local Input: Executor Path and Options = null] Feb 01, 2017 06:05:50 UTC [Local Input: Command Path = /bin/sh /tmp/FileUpload/test.sh] Feb 01, 2017 06:05:50 UTC [Local Input: Undo Script = null] Feb 01, 2017 06:05:50 UTC [Local Input: Error Codes = ] Feb 01, 2017 06:05:50 UTC [Output: EXIT_STATUS_CODE = 0] Feb 01, 2017 06:05:50 UTC [Output: COMMAND_OUTPUT = ] Feb 01, 2017 06:05:50 UTC Completed workflow item number 2, with status Completed Feb 01, 2017 06:05:50 UTC Executing workflow item number 3 Feb 01, 2017 06:05:50 UTC Completed workflow item number 3, with status Completed
As seen in the log, the command is executed directly on the VM.