Powershell Scripts in Exchange 2007
Hi ,
Im new to Exchange Scripts & powershell, Im using Exchange management shell to run the simple commands like get-mailboxstatistics and saving them as xx.msh. I will run whenever it is required.
. For this how powershell console.Are *.msh can be run in power shell console.
And how to install the powershell in Exchange server. we are having only Exchange management shell is installed in our exchange servers.
June 7th, 2010 10:49pm
Below link is how to run get-mailboxstatistics cmdlet
http://technet.microsoft.com/en-us/library/bb124612(EXCHG.80).aspx
You can save the powershell scripst with extention .ps1, if you want to schedule to run get-mailboxstattics, used your notepad and save below command as .ps1
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin
Get-MailboxStatistics <exchange server name> | Export-CSV C:\MailboxReport.csv
Then create a bat file like below command:
Powershell.exe -command "& {C:\pwdalert\MailboxStatistics.ps1 }"
During exchange installation, the requirement is to install Windows Powershell, without it you can't proceed exchange installation. So, i not sure why you able to install Exchange server without Windows Powershell?
Which OS are you running Exchange Server?It is Windows2003 or Windows2008. If you are running on Windows2008, you can install from "Add Feature" from Server Manager. However if running on Windows2003, please click in link to download Windows Powershell.
http://www.microsoft.com/windowsserver2003/technologies/management/powershell/download.mspx
Free Windows Admin Tool Kit Click here and download it now
June 8th, 2010 5:34am
Not sure why you are saving your commands in MSH files. you can save them in a PS1 file which can be run and PowerShell Env. MSH is Mash (The Microsoft Agent Scripting Helper).
And regarding Powershell in Exchange servers, Exchange Management shell is built on Powershell and is a form of Powershel only with custom PSSnapins of Exchange command lets. it means apart from Powershell basic command lets it also include Exchange cmdlets
which are provided by a PS Snapin (Microsoft.Exchange.Management.Powershell.Admin).
If you want to run Plain Powershell without Exchange Cmdlets then Just open RUN diag box and type Powershell and click OK. That's you are in Powershell without any Powershell Custom PS Snapin loaded.
hope you find this information helpful.
ThanksVishal Ramnani
MCITP - Exchange 2007,
MCSE Messaging,
MCTS - Win 2008 Config
June 8th, 2010 8:48am
Thank Surya and Vishal,
I Have tried to add the command Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin in my power shell to do the exchange tasks in powershell , but i am getting error message as below.
No.Windows Powesell Snap-ins are available for version 1.
Im using Exchange 2K7 in W2K3
Need your help to fix the same.
Thanks
Gopi
Free Windows Admin Tool Kit Click here and download it now
June 9th, 2010 12:07am
What are you trying to add? Are you trying to add Exchange Management? If so, then enter:
Add-PSSnapin Microsoft.Exchange
--
Ed Crowley MVP
"There are seldom good technological solutions to behavioral problems."
.
"GOPI K" wrote in message
news:0f6e2354-20e4-4735-984a-bdbbba597929...
Thank Surya and Vishal,
I Have tried to add the command Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin in my power shell to do the exchange tasks in powershell , but i am getting error message as below.
No.Windows Powesell Snap-ins are available for version 1.
Im using Exchange 2K7 in W2K3
Need your help to fix the same.
Thanks
Gopi
Ed Crowley MVP "There are seldom good technological solutions to behavioral problems."
June 9th, 2010 12:15am