cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1332
Views
1
Helpful
0
Comments
Orf Gelbrich
Cisco Employee
Cisco Employee
Task NamePower Shell example on moving a file
Description
  1. Change the user of a running workflow
Prerequisites
  1. Tested on 5.3.1
CategoryWorkflow
ComponentsvSphere 5.x
User Inputs
  1. userid to change to
Output

Instructions for Regular Workflow Use:

  1. Download the attached .ZIP file below to your computer. *Remember the location of the saved file on your computer.
  2. Unzip the file on your computer. Should end up with a .WFD file.
  3. Log in to UCS Director as a user that has "system-admin" privileges.
  4. Navigate to "Policies-->Orchestration" and click on "Import".
  5. Click "Browse" and navigate to the location on your computer where the .WFD file resides. Choose the .WFD file and click "Open".
  6. Click "Upload" and then "OK" once the file upload is completed. Then click "Next".
  7. Click the "Select" button next to "Import Workflows". Click the "Check All" button to check all checkboxes and then the "Select" button.
  8. Click "Submit".
  9. 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:

Screen Shot 2015-07-30 at 2.59.13 PM.png

User input:   (none)

The task:

This will move a file from 172.17.32.106 to 172.17.32.110 (the UCSD PS Agent)

Screen Shot 2015-07-30 at 3.00.18 PM.png

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:

Screen Shot 2016-09-01 at 1.34.03 PM.png

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

Screen Shot 2015-07-30 at 3.04.17 PM.png

The file moved:

     The abc file was moved

Screen Shot 2015-07-30 at 3.05.15 PM.png

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Quick Links