VS 2013 Release Management: Create Tool & Action to Run Custom PowerShell Scripts in Deployment Agent
Can a custom PowerShell script run in Release Management Deployment Agent?
One way is to create a PowerShell script and add it as a resource and create a tool and an action in Release Management Inventory. This is more suitable for adding a generic tool. But if it is required to run a custom PowerShell script specific to a given release template, copied to deployment machine from the build drop, is it possible? Out of the box set of tools and actions in Release Management Server do not support this. This can be done by creating a generic tool and an action.
Let's see how to do this step by step.
In Release Management Client go to Inventory tab Tools, click on New.
For the execution command type “powershell” and for the arguments type
-command __ScriptToExecute__ __Arguments__
This will add two parameters in the tool “ScriptToExecute” and “Arguments”. Provide a suitable Name and a Description as well.
Click on Save & Close to add the new tool.
Go to Actions and click on New to add new action.
Select the tool created and add a new Category for Custom Actions. Fill the Name and Description.v http://lh5.ggpht.com/-bpAzKmA29KY/U9PukUMgwSI/AAAAAAAACpA/AKH3maoQDkQ/005_thumb%25255B2%25255D.png?imgmax=800
Save to create the new Action.
To test Tool and Action in action create a very simple PowerShell script like below.
In a test release template new custom action is available.
Fill the script name with the path and arguments(for testing purpose script copied manually to deployment machine, this can be a script downloaded to deployment machine from the build drop using an XCOPY action in the release template).
Save the release template and click New Release to test. This example does not use a build out put, but the action can be used with a template bound to a build drop as well, as a matter of fact it can be used with any release template.
Start the release by clicking on Start.
Script execution succeeded.
Click on View Log to see the output from script.