Multi-Environment PowerShell console – AD, Exchange and PowerCLI in one happy place!

With the increase in the use of PowerShell as part of an administrator’s toolkit, it can be challening with multiple shells to administer different environments. I prefer using a single, multi-functional console, so what I have done is integrate all of the PowerShell modules into a single console using a simple script. This allows me to use one console to administer Active Directory, Exchange and VMware. Please note that this process is designed for Windows 7 only. 

If you have any issues, please let me know and I’d be glad to help with anything. I will also be putting together some quick documents for fundamentals of PowerShell. You can also come to me for any specific questions about PowerShell and scripting that you have.

Install PowerCLI 5.0

Download and Install PowerCLI 5.0 from VMware Communities page here: http://downloads.vmware.com/downloads/download.do?downloadGroup=PCLI50  taking all the defaults during the installation.

Install Remote Server Administration Tools for Windows 7

If you do not have the Remote Server Administration Tools (RSAT) for Windows 7 installed, follow these instructions to complete the installation and enable the PowerShell modules for Active Directory.

Download and install the RSAT extension for Windows 7 here: http://www.microsoft.com/download/en/details.aspx?id=7887  

Once that is completed (be patient, it takes a while), go to Control Panel | Programs and Features | Turn Windows features on or off to enable the new management tools.

 

 

Install the Microsoft Exchange 2010 Management Tools and hotfixes

Using the Microsoft Exchange 2010 DVD, install the management tools including the Management Console and Management Shell. Once you’ve installed these tools, you must run the Microsoft Updates for the Exchange tools or else you will be unable to connect as the Service Packs will not match up.

Setting up your environment

Create a folder under your Documents folder. I’ve chosen to name mine SCRIPTS-TEMP

Pin the VMware PowerCLI to the taskbar so you can access it more easily.

Hover over the icon on the taskbar, hold the Shift button and Right-Click the icon and select Properties

Change the Start in: location to the folder where you’ve placed your

Save the following into a file called MyConsole.ps1 inside the folder you created in the Documents folder before (e.g. SCRIPTS-TEMP) making sure that you edit the vCenter and Exchange server settings for your own environment.

# Import the Active Directory extensions
Import-Module ActiveDirectory
# Log in to vCenter to allow remote management
Connect-VIServer <Your vCenter Server Name Here>
# Create and import a PowerShell remote session to let you run Exchange 2010 commands from your single shell
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://<FQDN of Exchange 2010 server>/PowerShell/ -Authentication Kerberos
Import-PSSession $Session

Launching your shell

Hover over the icon on the taskbar, hold the Shift button and Right-Click the icon and select Run as different user (assuming you have a separate account for admin privileges) and enter your admin credentials when prompted.

Inside your VMware PowerCLI console type .MyConsole.ps1 and hit the Enter key. It will take a couple of minutes for the environment to load. Once the load is complete you will be back at the PowerCLI prompt as shown below.

 

You now can use any of the PowerShell commands for Active Directory, Microsoft Exchange 2010 or VMware PowerCLI.

Enjoy!

3 thoughts on “Multi-Environment PowerShell console – AD, Exchange and PowerCLI in one happy place!”

  1. Excellent! There’s no need for multiple PowerShell sessions. IT Pros might also consider adding the Group Policy module. If you don’t or can’t use the Microsoft AD provider, then sub in the free Quest AD cmdlets.

    One Shell to Rule Them All!

    Reply
  2. Good call on that one! I’m still going old school running GPMC so I’ll add that into the routine and update the script. Thanks for the suggestion 🙂

    Reply

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.