Rather than spending time clicking through the UI, an easier method is to add or redeploy the flows using PowerShell scripts. When FSIS is installed, several PowerShell snapins are installed to help manage flows. In this post, I’m going to outline the process of adding and removing CTS flows using PowerShell commands. This process has to be performed on the FSIS machine that is running the FSIS Admin.
Flow Files
Before the flows can be added or redeployed, it’s a good idea to store the .flow files in a location that can be referenced in the PowerShell script files. My standard location for the .flow files are C:fsisflowscts. You can obviously create your own location. Just make sure that the location is consistent across all environments so that your add and redeploy scripts don’t have to change from one environment to another.
Set up the PowerShell Environment
Before flows can be added or removed, the PowerShell environment has to be set up by adding in the snapins and connecting to the FSIS System and the FSIS Engine. Below are the PowerShell commands to set up the environment.
Add-PSSnapin JunoPSSnapin
Add-PSSnapin EnginePSSnapin
Connect-System
Connect-Engine
I like to put these four commands into a PowerShell script file named SetupPSEnvironment.ps1. This allows me to run these commands independent of the add and remove scripts.
Add a New Flow
Despite its name, the Get-Content command is the command to use to add a flow to FSIS. The syntax to add a flow is as follows: Get-Content <flow file> | Out-String | Add-Flow -FlowName <flow name>. Example: Get-Content C:fsisflowsctsTest.flow | Out-String | Add-Flow -FlowName CTSTest.Test
I’ve got an AddFlows.ps1 PowerShell script file that adds all my flows to FSIS. This file contains the Get-Content commands for all the flows in my FSIS system.
Redeploy a Flow
To me, redeployment is the process of updating an existing CTS flow. However, FSIS does not have an update flow feature. Therefore, the only way to update a flow is to remove it from FSIS and add it back in. The syntax to remove a flow is as follows: Remove-Flow <flow name>. Example: Remove-Flow CTSTest.Test. Once the flow is removed, simply add the flow back in using the Get-Content command.
I’ve got a RemoveFlows.ps1 PowerShell script file that removes all my flows to FSIS. This file contains the Remove-Flow commands for all the flows in my FSIS system.
Summary
That’s it. It’s pretty simple. For flexibility, I create the three script files mentioned above – one to setup the PowerShell environment, one to add the flows, and another to remove the flows. I always use the SetupPSEnvironment.ps1 script to set up my environment. Then depending on what I’m doing, I’ll run either the RemoveFlows.ps1 script or the AddFlows.ps1 script. Typically, I only run the AddFlows.ps1 script the first time I’m setting up an environment. Once an environment is set up, I just run the RemoveFlows.ps1 script followed by AddFlows.ps1 script. This ensures that FSIS is set up correctly for all the flows that I want deployed to my FSIS system. On occasion, I will run the Remove-Flow and Get-Content commands in an ad-hoc manner when I’m dealing with just a few flows instead of the entire set.
If you have any questions regarding this blog post, please feel free to email me at at rem@pointbridge.com. I welcome feedback on this content and also greatly appreciate suggestions for grammatical and/or spelling errors.