How to script Exchange powershell commands?
Posted on 2008-10-23
I would like to run a Exchange cmdlet from a PowerShell command line inside an ASP web page using wscript object.
The code look like this:
wshell.run "%COMSPEC% /C C:\Windows\system32\windowspowershell\v1.0\powershell.exe -PSConsoleFile 'C:\Program Files\Microsoft\Exchange Server\bin\exshell.psc1' -command "". 'set-mailbox [username] -ApplyMandatoryProperties'"", 0, TRUE
Essentially I just want to run the above set-mailbox command inside of an ASP page WITHOUT putting set-mailbox command in a ps1 file and execute it. Could you tell me what is the best way to do it?