Enabling Script Support

The DirectoryListWithArguments.ps1 script will not run in Windows PowerShell by default. This is because scripting support is disabled by default in Windows PowerShell. If you attempt to run a Windows PowerShell script when the support has not been enabled, an error will occur, and the script will not run. This error message is seen in Figure 4-1.

Error generated when attempting to run a Windows PowerShell script when execution policy not set

Figure 4-1. Error generated when attempting to run a Windows PowerShell script when execution policy not set

This is referred to as the restricted execution policy. There are four levels of execution policy that can be configured in Windows PowerShell by using the Set-ExecutionPolicy ...

Get Microsoft® Windows PowerShell™ Step By Step now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.