2
votes

Ive never used powershell before but it seems like the correct tool to use to read the number and size of mailboxes on our 2007 and 2010 exchange servers. I'm running Powershell on Windows 7 and NOT on the exchange server. The commands used in the examples i have found are not recognised.

From my initial reading it appears i need the Exchange snap in. However, i can't seem to find a download page or instructions for loading it into Powershell, or if it is even possible to access this data from a workstation other than the exchange server. I was wondering if some one could give me some feedback on my problem and point me in the right direction.

thanks.

3

3 Answers

1
votes

I have gotten this to work on windows 7 64 bit with exchange 2007 64

I installed the exchange management console via the exchange server 2007 installation files

you don't need to establish a remote powershell session, you run the commands with a domain/network administrator privileged powershell on the workstation.

I'm trying to get just the powershell snapin as I don't need the whole console, but as of right now, with the whole console and powershell you can load the exchange management snapin to powershell and create mail-enabled user accounts.

after installing the exchange management console you can execute

add-pssnapin microsoft.exchange.management.powershell.admin

to load the exchange snapin and begin pulling exchange data.

on top of that you may need to start the service on the exchange server "microsoft exchange system attendant"

0
votes

i guess you need to establish a powershell remote session to the exchange server and run your powershell cmdlets.

You can start with having a look at the help about remote powershell

PS C:\Windows\system32> help about_Remote

Once you establish a remote powershell session to the exchange server you can add the Exchange Management Shell snap-in from Windows PowerShell Click Start, click Programs, and then click Windows PowerShell 1.0, Click Windows PowerShell, Type the following command:

Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin

Use the chdir command to change to the Exchange Server\Bin directory. For example, type:

chdir "c:\program files\microsoft\exchange server\bin"

Type the following command:

.\Exchange.ps1

Once the exchange module is loaded you can start using the various cmdlets.

0
votes

I had the same problems when I was first trying to get this work, and it was never clear to me what I needed to do. I was very new to Powershell and was trying to run the add-pssnapin without first creating a new session.

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://EXCHANGE-SERVERNAME/PowerShell/ -Authentication Kerberos -Credential $myCred
Import-PSSession $Session

Where the -ConnectionUri points to your exchange server name and the $myCred holds your admin credentials to access the server.

This will import all modules you can use against MS Exchange.

Note1: you can narrow this down to improve the speed of the import by only selecting to import certain modules you will be using. Good if, for example, you know you will only use certain tools. You can do this by adding -CommandName and list necessary aliases you want to import.

Note2: Good practice to remove the sessions after you are finished:

Remove-PSSession $Session