Thursday, February 1, 2018

How to Integrate PowerShell into UiPath Workflows(RPA)

PowerShell is a complex framework developed by Microsoft that allows for task automation and configuration management.
We want to provide our users with the option to integrate PowerShell and its powerful capabilities into the UiPath workflows. Integration is made through the InvokePowerShell activity. Usage may differ from one workflow to another - you can invoke simple commands/cmdlets or run complex scripts and jobs.

In the attached example (ReadTextFile workflow), the InvokePowerShell activity is used two times:

1. To return all the .txt files from the current directory (the workspace of the workflow).
2. To get the content from each of the .txt files found in the current directory.

Workflow Steps


1. Create a .txt file (Example.txt), containing the text "PoweShell is awesome!". The WriteTxtFile activity is used.
PowerShell_WriteTextFile_.png
2. Get the .txt files from the current directory using Get-ChildItemcmdlet with  2 parameters: Filter (to return only the .txt files) and Recurse. The parameters are set by adding them in the Parameters collection.
PowerShell_GetChildItem.png
The result is a collection of FileInfo (it was changed using the TypeArgument property from Collection of PSObject to Collection of FileInfo).
3. Then we start a ForEach iteration, which will process each of the .txt files found at the previous step.
PowerShell_ForEachContent.png
4. For each file, we will use InvokePowerShell activity with Get-Contentcmdlet that will read the content of the file and save it into the contents collection.
PowerShell_GetContent.png
5. A message box with the first line of the file (index is 0  - contents(0).tostring) pops up.

We plan to develop more in the PowerShell area and we will try to improve both - the PowerShell activities pack and the specific documentation.
Note: The workflow is tested with UiPath Studio 8.
Attachments: 

19 comments:

  1. Thank you for sharing this useful information uipath Online Training

    ReplyDelete
  2. Very Impressive RPA tutorial. The content seems to be pretty exhaustive and excellent and will definitely help in learnig RPA course. I'm also a learner taken up RPA training and I think your content has cleared some concepts of mine. While browsing for RPA tutorials on YouTube i found this fantastic video on RPA Tutorial. Do check it out if you are interested to know more.:-https://www.youtube.com/watch?v=x0oC6NKEPgQ

    ReplyDelete
  3. I believe there are many more pleasurable opportunities ahead for individuals that looked at your site.

    https://www.kausalvikash.in/blog/non_it-person-uipath-rpa-journey/
    https://youtu.be/C74GS0OraAw

    ReplyDelete
  4. I wish to indicate because of you only to bail me out of this specific trouble.As a consequence of checking through the net and meeting systems that were not beneficial, I thought my life was finished
    CRM Software

    ReplyDelete
  5. Excellent article and with valuable content. I learned a lot here. Do share more like this
    UiPath Training in Chennai
    UiPath Online Training
    UiPath Training in Bangalore

    ReplyDelete
  6. This Content is simply amazing, and helpful for students and business people. Gathered lots of information and waiting to see more updates.
    RPA Training in Chennai
    RPA Online Training
    RPA Course in Coimbatore

    ReplyDelete
  7. Excellent Blog, I like your blog and It is very informative. Thank you
    Cyber Security
    Importance of Cyber Security

    ReplyDelete
  8. Discover unparalleled reliability and performance at our Data Center in Atlanta. Experience seamless connectivity and robust security solutions.

    ReplyDelete