How to: Managing Exchange 2000/2003 using PowerShell - Part I

 

Introduction

Most folks I talk to have installed Powershell, but not done much with it. Most of these folks also run Exchange 2000 or Exchange 2003 and don't dream of managing Exchange from anything else but the GUI or VBScript. Point in case, a lot of Exchange 2003 information is available via WMI. Powershell makes WMI information rapidly accessible via the Get-WMiObject, or it's alias gwmi. Aliases are a shortened version of a command and are interchangeable. Makes for quicker typing.

Lets look at an example:

I'm going to attach to my local Exchange server and retrieve the list of available queues. Once I have those, I'll ask the results to be formatted into a table, and only return the headings I want. My local server's name is 2003server. Don't forget to change that to be the Exchange server in question. Get-WmiObject has a short name of gwmi. Either may be used interchangeably.

Here's the command line.

Get-WmiObject ExchangeQueue -Namespace "root\cimv2\applications\exchange" -ComputerName 2003server | Format-Table VirtualMachine, LinkName, QueueName, NumberofMessages


If you like that, but don't like the format, then you change the format of the output to be a list as opposed to a table by piping to Format-List instead of Format-Table. Try it or try copying the code below:

Get-WmiObject ExchangeQueue -Namespace "root\cimv2\applications\exchange" -ComputerName 2003server | Format-List VirtualMachine, LinkName, QueueName, NumberofMessages

If you liked this article and would like to see more about PowerShell and Exchange, then check out BlankMan’s blog (that’s me) on http://blankmanblog.spaces.live.com/. Please also leave me a comment on what you do and don’t like.

Discuss this in

About Nicolas Blank

Nicolas Blank - Operations Director, Credo Technical Services

Nicolas Blank is a Microsoft Infrastructure Architect and Operations Director for Credo Technical Services in South Africa and specializes in Exchange, Active Directory, architecture, systems management, migration and scripting. Nicolas is a Microsoft MVP for Exchange and spends what spare time he has writing, blogging and talking about Exchange and associated technologies. www.credotech.co.za


Featured Links

Microsoft Messaging Resources Search


Subscribe to Articles

Receive monthly article updates.

Join our Exchange forum | View forums