O'Reilly logo

Windows PowerShell™ 3.0 Step by Step by Ed Wilson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Scripting fundamentals

In its most basic form, a Windows PowerShell script is a collection of PowerShell commands. Here’s an example:

Get-Process notepad | Stop-Process

You can put a command into a Windows PowerShell script and run it directly as it written.

To create a Windows PowerShell script, you simply have to copy the command in a text file and save the file by using a .ps1 extension. If you create the file in the Windows PowerShell ISE and save the file, the .ps1 extension will be added automatically. If you double-click the file, it will open in Notepad by default.

Running Windows PowerShell scripts

To run the script, you can open the Windows PowerShell console and drag the file to the console. If you first copy the path of the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required