txt
Notice that in this example the Out-File cmdlet ??? intercepted ??? the output and nothing is displayed
on the screen. This is because the information was directed to Out-File and not Out-Host . Other
parameters for Out-File include Append and NoClobber . Use the Append parameter to add the
output stream to the end of the file specified by FilePath . The NoClobber parameter is used to
prevent the command from overwriting an existing file with the same path name that is specified by
FilePath parameter .
Part I: PowerShell for Exchange Fundamentals
48
Using Variables, Aliases, and Functions
Windows PowerShell provides the ability to create user - defined command elements and store them in
memory to make entering and running commands easier.
Variables
Windows PowerShell variables are basically named objects that you can use later in another command.
Variable names begin with the $ character followed by any combination of alphanumeric characters. To
create a variable simply enter the name at the command line. The variable is created but no value is
assigned. To assign a value to a variable, enter the name followed by the equality symbol ( = ) and the
value. The value can be a literal value such as an integer or string value, or it can be the results of a
cmdlet. For example, to create a variable called $exservers and assign it the value of all Exchange
servers in the organization, use the following command:
[PS] C:\ > $exservers = Get-ExchangeServer
Notice there is no feedback to indicate the command completed successfully.
Pages:
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94