Datasheet
8 CHAPTER 1
•
USING POWERSHELL WITH ACTIVE DIRECTORY
Use the Scripting Environment
PowerShell 2.0 provides a new Integrated Scripting Environment (ISE) for
writing PowerShell scripts with more ease. e ISE provides some great capa-
bilities that are typically found in expensive development environments. Full
development environments o er additional features that justify the cost if you’ll
be writing a lot of code; but if you’re just looking for basic debugging and script
writing, you need look no further than the ISE.
e PowerShell ISE isn’t installed by default on Windows Server 2008 R2, so you’ll
need to add it if you want to use it. You can install the PowerShell ISE through
Server Manager, using the
Add-WindowsFeature
PowerShell cmdlet. is cmdlet
isn’t registered by default, so you must rst import the Server Manager module in
PowerShell:
Import-Module ServerManager
A er the module is imported, you have access to the
Add-WindowsFeature
cmd-
let. You can run the following command to add the PowerShell ISE:
Add-WindowsFeature PowerShell-ISE
e 3.5.1 version of the .NET Framework is required for the ISE, so you may notice
that installing as well if it’s not already installed on your server. A er you install
the ISE, you can launch it by clicking the Start menu and selecting All Programs
‚
Accessories
‚
Windows PowerShell
‚
Windows PowerShell ISE.
e ISE will be launched as shown in Figure 1.4. It consists of three panels that
assist you in writing scripts:
Script Editor e script editor is the top panel of the ISE. You can have multiple
scripts open at the same time, and each script will have its own tab in the editor.
You can run your script and test it in the editor by clicking the green arrow in the
toolbar.
Command Pane e bottom panel is called the command pane. is pane pro-
vides you with an interactive PowerShell command interface just as if you were
using the shell itself. You can type in commands freehand and see the results. is
is especially useful when determining the syntax of your command before inserting
it into a script.
Output Pane e output pane is the middle pane in the ISE. When you run the
script you’re writing or execute a command in the command pane, the output is
displayed in the output pane.
c01.indd 8c01.indd 8 5/12/2011 1:07:42 PM5/12/2011 1:07:42 PM