Datasheet
Chapter 1: Getting Started with Windows PowerShell
29
To change this behavior, add the AutoSize parameter to force Format-Table to change column widths
to make the most of the console screen width, and the
Wrap parameter to wrap long values that won ’ t fit
on a single line to the next line. The addition of these two parameters to the previous example yields the
results shown in Figure 1 - 24 .
Figure 1-24
Running Scripts
As you learn to use Exchange Management Shell to manage your Exchange organization you will most
likely identify several command sequences that you run on a regular basis to accomplish some task.
Store these commands in a Windows PowerShell script file so you can run them all by simply executing
the script file. Use your favorite text editing software to create and edit script files. Windows PowerShell
script files use
.ps1 as the file extension name.
To run a script, type its name at the command line. You do not have to include the
.ps1 file extension.
However, you do have to pay attention to the drive location where the script is stored and the current
location from which the script is being run. You must supply the full path to the script file even if the
script is stored in the current location. To tell Windows PowerShell the script is in the current directory,
either type the full path or use a dot and backslash (.\) to indicate the current directory as shown in this
example:
[PS] C:\scripts > .\myscript
Exchange Management Shell provides a default directory for storing several script files provided
with Exchange Server 2007. You do not have to provide the full path name when running any script
located in the
%ProgramFiles%\Microsoft\Exchange Server\scripts directory because this path
is stored in the Windows system variable path statement as part of Exchange Server installation.
By placing your script files in this directory you can keep them in a known directory and run them from
any drive location without providing the full path.
The chance that a script may include destructive code may raise security concerns among administrators.
Windows PowerShell provides a method for applying a security policy for controlling which scripts are
allowed to run on a machine. The execution policy determines whether or not scripts are allowed to run,
and whether they must include a digital signature that verifies the origin of the script and if it has been
tampered with in any way since it was digitally signed by its creator.
c01.indd 29c01.indd 29 12/17/07 3:19:31 PM12/17/07 3:19:31 PM