Databases Reference
In-Depth Information
All the commands that you will be familiar with from cmd.exe are available, such as DIR . You will
also have access to a wealth of new commands that are provided with PowerShell; these commands
are commonly known as cmdlets .
PowerShell ships with a host application, the PowerShell Integrated Scripting Environment (ISE).
This is installed by default in Windows 7 and can be enabled by installing the “Windows PowerShell
Integrated Scripting Environment (ISE)” feature on Windows Server 2008 R2. The PowerShell ISE
enables you to create script i les, which by convention have an extension of . PS1 . You can also debug
and run scripts from within this environment; although this is a signii cant improvement from using
Notepad and the command window in PowerShell 1, there is still room for improvement.
I prefer to use PowerGUI, a free PowerShell Scripting Environment that is available for download
from www.powergui.org . PowerGUI also offers a wealth of additional cmdlets that have
been written by the PowerGUI community, providing functionality that is not available
out-of-the-box with PowerShell. If you also use Visual Studio, you're in luck, because Adam Driscoll
has created a Visual Studio, extension (VSX) for PowerShell that uses PowerGUI. You can
download the VSX from http:/visualstudiogallery.msdn.microsoft.com/
01516103-d487-4a7e-bb40-c15ec709afa3 ; this extension enables you to create, debug, and
manage scripts within the Visual Studio IDE.
A growing community of users has contributed additional cmdlets and modules. The best known
and supported set of community functionality is available at http://pscx.codeplex.com . The
PowerShell Community Extensions (PSCX) utility is worth downloading and keeping locally
because it contains numerous cmdlets, functions, and modules to facilitate your work with
respect to many aspects of Windows. A set specii c to SQL Server, known as the SQL PowerShell
Extensions, is available from http://sqlpsx.codeplex.com .
Security was an important consideration when the product team created PowerShell. With such
an integrated and extensible scripting and command-line interface, it was critical to consider how
users would be protected from unauthorized scripts executing. A key feature of this is the Execution
Policy, which is a systemwide coni guration that specii es the type of scripts that can be executed on
the computer. Table 14-1 summarizes the four possible values for the Execution Policy.
TABLE 14-1: PowerShell Execution Policies
EXECUTION POLICY
DESCRIPTION
Restricted
No scripts can be run. Windows PowerShell can be used only in interactive
mode.
AllSigned
Only scripts signed by a trusted publisher can be run.
RemoteSigned
Downloaded scripts must be signed by a trusted publisher before they can be
run.
Unrestricted
No restrictions; all scripts can be run.
You can check the current status of the Execution Policy on your computer with the
Get-ExecutionPolicy cmdlet. The following example shows how my computer is currently coni gured.
Search WWH ::




Custom Search