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

Chapter 5 quick reference

To

Do this

Retrieve the script execution policy

Use the Get-ExecutionPolicy cmdlet.

Set the script execution policy

Use the Set-ExecutionPolicy cmdlet.

Create a variable

Type the variable name in the script.

Create a constant

Use the New-Variable cmdlet and specify constant for the -option argument.

Loop through a collection when you do not know how many items are in the collection

Use the ForEach-Object cmdlet.

Read the contents of a text file

Use the Get-Content cmdlet and supply the path to the file as the value for the -path argument.

Delete a folder

Use the Remove-Item cmdlet and supply the path to the folder as the value for the -path argument.

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