Prev | Current Page 86 | Next

Joezer Cookey-Gam, Brendan Keane, Jeffrey Rosen, and Jonathan Runyon

"Professional Windows PowerShell for Exchange Server 2007 Service Pack 1"


Alias definitions only allow for the name of a cmdlet, so you cannot include any parameters or
values. Use functions to define more complex commands.
Alias names must start with a letter, but the rest of the name can contain any combination of
alphanumeric characters.
??‘
??‘
??‘
Part I: PowerShell for Exchange Fundamentals
50
To create a new alias, use New-Alias or Set-Alias followed by the name of the alias and the name of
the cmdlet it represents as shown in this example for creating an alias called setweb for the cmdlet
Set-WebServicesVirtualDirectory cmdlet:
[PS] C:\ > Set-Alias setweb Set-WebServicesVirtualDirectory
There is no feedback to tell you the command completed successfully. Use the Get-Alias cmdlet to
confirm an alias ??™ s definition:
[PS] C:\ > Get-Alias setweb
CommandType Name Definition
----------- ---- ----------
Alias setweb Set-WebServicesVirtualDirectory
Like user - defined variables, user - defined aliases persist only as long as the current shell session. You
need to add their definitions to the user profile to have them available each time the shell is started.
Functions
A Windows PowerShell function is a named block of code containing one or more commands that can be
run as a single command by entering the name of the function. Functions can be created as input
directly at the command line or included as part of a script.


Pages:
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
2 1 mieszkania sosnowiec agencja reklamowa poznań parasole reklamowe Paula Atherton