Task Name | Power Shell example on moving a file |
Description | - Change the user of a running workflow
|
Prerequisites | - Tested on 5.3.1
|
Category | Workflow |
Components | vSphere 5.x |
User Inputs | - userid to change to
|
Output | |
Instructions for Regular Workflow Use:
- Download the attached .ZIP file below to your computer. *Remember the location of the saved file on your computer.
- Unzip the file on your computer. Should end up with a .WFD file.
- Log in to UCS Director as a user that has "system-admin" privileges.
- Navigate to "Policies-->Orchestration" and click on "Import".
- Click "Browse" and navigate to the location on your computer where the .WFD file resides. Choose the .WFD file and click "Open".
- Click "Upload" and then "OK" once the file upload is completed. Then click "Next".
- Click the "Select" button next to "Import Workflows". Click the "Check All" button to check all checkboxes and then the "Select" button.
- Click "Submit".
- A new folder should appear in "Policies-->Orchestration" that contains the imported workflow. You will now need to update the included tasks with information about the specific environment.
The workflow:
User input: (none)
The task:
This will move a file from 172.17.32.106 to 172.17.32.110 (the UCSD PS Agent)
The script:
echo "net use Y: \\172.17.32.106\Share /Persistent:Yes password@123 /user:baylordemo.local\administrator" > c:\\remcopy.ps1
echo "Copy-Item Y:\\abc.txt.txt c:\\abc.txt" >> c:\\remcopy.ps1
c:\\remcopy.ps1
SQL install
==========
Thank you to Becky and Reuben:
The SR_LOG:
Service Request ID: 5438
Workflow Inputs:
- VMName
Jul 30, 2015 19:54:13 UTC Request submitted
Jul 30, 2015 19:54:17 UTC Executing workflow item number 1
Jul 30, 2015 19:54:17 UTC Completed workflow item number 1, with status Completed
Jul 30, 2015 19:54:20 UTC Executing workflow item number 2
Jul 30, 2015 19:54:20 UTC Trigger context executeWorkFlowStep called
Jul 30, 2015 19:54:21 UTC Executing custom action PowerShellCopyFile (Execute PowerShell Command)
Jul 30, 2015 19:54:21 UTC Executing custom action PowerShellCopyFile (Execute PowerShell Command)
Jul 30, 2015 19:54:24 UTC Max wait time min milli seconds = 300000
Jul 30, 2015 19:54:25 UTC executor finished.....true
Jul 30, 2015 19:54:25 UTC Command Output: <?xml version='1.0'?><Objects />Command successful
Jul 30, 2015 19:54:25 UTC
Jul 30, 2015 19:54:25 UTC Command executed successfully.
Jul 30, 2015 19:54:25 UTC <?xml version='1.0'?><Objects />Command successful
Jul 30, 2015 19:54:27 UTC Task #1 (PowerShellCopyFile (Execute PowerShell Command)) completed successfully in 6 seconds
Jul 30, 2015 19:54:27 UTC Input/Output values for Task #1 (PowerShellCopyFile (Execute PowerShell Command)):
Jul 30, 2015 19:54:27 UTC [Local Input: Label = Power]
Jul 30, 2015 19:54:27 UTC [Local Input: PowerShell Agent = 172.17.32.110]
Jul 30, 2015 19:54:27 UTC [Local Input: Target Machine IP = 172.17.32.110]
Jul 30, 2015 19:54:27 UTC [Local Input: User ID = administrator]
Jul 30, 2015 19:54:27 UTC [Local Input: Password = **masked-value**]
Jul 30, 2015 19:54:27 UTC [Local Input: Domain = ciscodemo.local]
Jul 30, 2015 19:54:27 UTC [Local Input: Commands/Script = echo 'net use Y: \\172.17.32.106\Share /Persistent:Yes password@123 /user:baylordemo.local\administrator' > c:\\remcopy.ps1 echo 'Copy-Item Y:\\abc.txt.txt c:\\abc.txt' >> c:\\remcopy.ps1 c:\\remcopy.ps1 ]
Jul 30, 2015 19:54:27 UTC [Local Input: Maximum Wait Time = 5]
Jul 30, 2015 19:54:27 UTC [Output: POWERSHELL_COMMAND_RESULT = <?xml version='1.0'?><Objects />Command successful]
Jul 30, 2015 19:54:27 UTC Completed workflow item number 2, with status Completed
The file created:
The file recopy was created on 172.17.31.110
The file moved:
The abc file was moved