Scripts in PowerShell ISE – Chapter 2

The last chapter was a quick intro to PowerShell ISE and the commonly used cmdlets. Now lets take a look at creating and executing scripts in ISE.

Example -> Reading file contents

Step (a): Open PowerShell ISE application

Step (b): Type in the below cmdlet in the script window-

Get-Content “C:\Users\Documents\sampledocument.txt”

Step (c) : Save the file as “samplefile.ps1

Step (d): Select the content of the script and click on “RUN” button on toolbar or press “F5”

Step (e): View file contents in the bottom panel

Isn’t it easy ?? Try out creating scripts with the cmdlets shared in Chapter 1.

Happy Scripting !!