Exchange Server 2007: Scripting Corner Volume 3 - The PowerShell profile

While working with (playing around with) PowerShell on Exchange 2007 I found myself typing in the same series of commands over and over. These were commands that I was using on a regular, repeated basis while managing my particular environment. Being the efficient (lazy?) person that I am, I did a bit of quick reading […]

While working with (playing around with) PowerShell on Exchange 2007 I found myself typing in the same series of commands over and over. These were commands that I was using on a regular, repeated basis while managing my particular environment. Being the efficient (lazy?) person that I am, I did a bit of quick reading and found the Windows PowerShell profile.

The windows PowerShell profile is a special .ps1 file that PowerShell will load when you initially start your session. PowerShell will automatically load any aliases, function, or variables defined in this file. The profile can be defined on a per system or per users basis. For more in depth information on the Windows PowerShell profile check out this MSDN article http://msdn2.microsoft.com/en-us/library/bb613488.aspx .

For my profile.ps1 I wanted to cover some of the basics and eliminate some of the annoyances that I was having when working with my systems. So I wrote six small functions that help me with the day to day workings of Exchange in PowerShell.
Functions: fhelp and ehelp

In the PowerShell beta when you typed "help <cmdlet>" you would get the full help output, all big and messy with all of the parameters and everything you ever wanted to know about the cmdlet. For the release version "help <cmdlet>" will just get you the basic quick help. When I am writing a script many times I need the full help for more information about the switch I am using. Thus the fhelp function was born.

Typing "fhelp <cmdlet>" will give you the full help just like in the beta days; and it is much faster than typing out "help <cmdlet> -full".

Full Article

Exchange 2007, Exchange Server 2007, PowerShell, Scripting, Profile, Administration, Tips, Tricks, Tips and Tricks, Microsoft