How to enable-user in command line(cmd file), not in exchange command line?
Hello, I can use "Enable-MailUser" in Exchange Command Line tools, which is a powershell cmdlet. But the "Enable-MailUser" cmdlet is not in powershell.exe. I want tocreate a cmd file(.cmd) and invoke the "Enable-MailUser" cmdlet.Howto do it?
July 26th, 2009 9:13pm
We need to load the Exchange Management Shell snap-in in order to run the exchange cmdlets in the powershell.exe
Using the Exchange Management Shell
You can create a powershell script to enable the mail users
=====================Script.PS1=====================
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin
Enable-MailUser -Identity 'foo foo' -Alias 'ffoo' -ExternalEmailAddress 'SMTP:foofoo@foobar.com'
=====================Script.PS1=====================
Resources:
Running Windows PowerShell Scripts
Free Windows Admin Tool Kit Click here and download it now
July 27th, 2009 7:23am
Hello James, thanks for your reply. it works well:)
July 27th, 2009 7:28am
You need to have Exchange Management Tools installed on the workstation/server where you are trying to run this in cmd prompt.
Below is the way to execute Exchange cmdlet....
PowerShell.exe -PSConsoleFile "C:\Program Files\Microsoft\Exchange Server\Bin\ExShell.psc1" -Command "Enable-MailUser UserName"
Or you can create a powerhsell script in ps1 file...
How To: Schedule PowerShell Script for an Exchange Task
http://exchangeshare.wordpress.com/2008/12/08/how-to-schedule-powershell-script-for-an-exchange-task/
Amit Tank | MVP Exchange Server | MCITP: EMA | MCSA: M | http://ExchangeShare.WordPress.com
Free Windows Admin Tool Kit Click here and download it now
July 27th, 2009 7:31am