PowerShell MS Exchange - Part1

Setup the environment:

I was always against using any management tools on production servers. from my point of view is always better setup management environment on a PC or server, which is not involved in any important task constantly. So here I will show how I setup my PowerShell environment for managing Exchange 2010. 
I do it on Windows 2008 R2 server or Windows 7 PC (64-bit) with current service packs.
First: I will install Exchange 2010 Management Console About Exchange Console with the same Service Pack what I have on my Exchange servers. It give me PowerShell Snapin, which  I will add to PowerShell profile later.
Second: I will configure PowerShell profile, there are at least 3 directory where I can put the profile, I put it in  C:\Windows\System32\WindowsPowerShell\v1.0 and name of the file profile.ps1 this profile will be default profile for all users and the regular powershell.exe (64-bit) as GUI powershell - powershell_ISE.exe. To use GUI version on Windows 2008 R2 server I need to add corresponding feature on Windows 7 I will have by default (I think). So in the profile.ps1 using Notepad or Notepad++ (I will recommend to download last one) I will next code (for goal only Exchange setup I will need just the line - add-pssnapin Microsoft.Exchange.Management.PowerShell.E2010, every other line of code depends from what I need for the environment in full):

Import-Module ActiveDirectory
Import-Module FailoverClusters
Import-Module ServerManager
Import-Module WebAdministration
add-pssnapin Microsoft.Exchange.Management.PowerShell.E2010
cd $psp

I will create subdirectory under \domain.local\netlogon named like ps-scripts and will put all my PowerShell scripts in this directory to replicate them through domain. So by loading profile.ps1 I will go to this directory by default.
All set for now, next will be in Part2.
Recommended PowerShell book: The book - Free

Disclaimer: I am not a professional programmer and nor professional writer so excuse my mistakes. Thank you.

No comments:

Post a Comment