Resources

Knowledge Base

IT Automation. PowerShell. Read Text Files

 

Task

This sample gets all the text files from the folder and displays their contain using PowerShell commands.

Steps to automate

  1. In case there isn't a text document in the folder, the workflow creates one.
  2. Get all the text documents from the folder.
  3. For each one, extracts their content and displays it.

Solution

  1. Use "Write text file" activity to create a text document. If you have text files in folder you can skip this part.
  2. Using "Invoke PowerShell" activity, you can send commands from your workflow to Windows PowerShell.
  3. Display the content of each text document using a "For Each" and a "Message Box" activity.

PowerShell_commands-1