Welcome to my latest commodity teaching you to assassinate a PowerShell calligraphy via the SSIS Action Task. The Assassinate Action Task may be acclimated to assassinate aloof about any EXE action and has a cardinal of inputs, amidst which are the bifold aisle and command band arguments.
The affair back attempting to assassinate a PoSh action arises back the arguments cord (or announcement if you’re application one) is not appropriately formed. Indeed this has bent out abounding bodies in the past, so I anticipation it was account visiting to detail absolutely how to configure the action itself. The able basal of the arguments string is accomplished by way of correctly escaping any characters that may contrarily be interpreted differently.
For this demonstration, I’m activity to actualize a basal package. I’m activity to use an announcement based altercation cord that will be formed application amalgamation variables and normal text. Let’s attending at the amalgamation bound now. We’ll charge to add an “xecute Action Assignment to start. You can see the assignment in Diagram 1.
Now that the assignment has been added, as apparent in Diagram 2, save the package.
We now charge to add the appropriate variables that will be acclimated to accumulation the Powershell executable Arguments parameters, abacus amalgamation variables is a adequately accepted process. We charge three variables.
Already you accept the variables added we’ll configure the action task. Here we see the variables created with some absence values.
Now let’s adapt the task. The aboriginal tab is the General tab, area we accord the assignment a allusive name.
Our assignment will be announcement based, so go to the “Expressions” tab.
After selecting the “Arguments” property, bang the elipsis on to accessible the announcement builder. Actuality we anatomy and evaluate the Arguments expression. This is apparent in Diagram 6.
Let’s booty a moment to disect the cord I’m using. Here’s the accomplished string
“-ExecutionPolicy Unrestricted -File “” @[User::ScriptPath] “\exec chic script.ps1” “” @[User::FName] “” “” @[User::SName] “””
Those of you who are acclimated to architecture activating SQL strings will accept the action of artifice distinct quotes back cord building. We accept to perfom agnate artifice in SSIS to accomplish the string clear to the PowerShell subsystem. in SSIS escape sequences use a backslash ( ).
The escape sequences are listed as
Now back PowerShell uses citation marks for constant passing, if these citation marks are not accurately able in the cord expression, the command band arguments will be nonsense. In that case, Powershell will abort the command. Had I not able the aloft cord accurately and anesthetized this
“-ExecutionPolicy Unrestricted -File “” @[User::ScriptPath] “exec chic script.ps1” “” @[User::FName] “” “” @[User::SName] “””
The announcement architect would abort to appraise and save the string. This is how the announcement should attending already adored and evaluated
Finally, on the Action tab of the Assassinate Action TaskEditor dialog, we see the abounding EXE and Altercation parameters.
The PowerShell calligraphy itself that I’m calling is apparent below.
The PowerShell calligraphy agreeable is abundant here.
Already adored and compiledbuilt, the amalgamation may either be uploaded to a SQL Server instance or stored on the NTFS book system. I’ve stored abundance in SQL Server and configured my SQL Server abettor job as apparent in Diagram 10. Notice the new ethics I’ve anesthetized to the variables.
Now back my abettor job runs, the PowerShell calligraphy is best up from the new location, and I get an achievement book in the area defined in the PowerShell scipt. This aisle is: C:supportposhscriptout.log
The defaults I acclimated for the variables in my amalgamation were
Firstname = Perry
Surname = Whittle
ScriptPath = C:
The achievement file contains the followng text:
Now we accept apparent how to bureaucracy an “Execute Action Task” to run a PowerShell script, I do achievement you acquisition this useful, it will hopefully save you hours of beard affairs aggravating to assignment out why your cord is invalid. Farewell until aing time, and as always, column in the discussion, and I’ll advice all I can with any queries.
Why Is Everyone Talking About Sequence Diagram Builder? | Sequence Diagram Builder – sequence diagram builder
| Allowed to my own blog, on this time I will teach you in relation to sequence diagram builder