0
votes

i am runing powershell and from my powershell i want to connect to my Exchange powershell,
the diffrance betwwen the two files is in their target(right click =proproties),

"normal" powershell target ="%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe"

"exchange" powershell target = "C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe -PSConsoleFile "C:\Program Files\Microsoft\Exchange Server\bin\exshell.psc1" -noexit -command ". 'C:\Program Files\Microsoft\Exchange Server\bin\Exchange.ps1'""

is there a way to connect to the exchange powershell by code??, my guess is to add those two extra line like in the target...

1

1 Answers

2
votes

That command line will only work if the Exchange management tools are installed (it's going to try to load the Exchange management snapin.

Generally, it's easier to use implicit remoting in a script and import the functions from the remote shell into your current session:

http://www.mikepfeiffer.net/2010/02/managing-exchange-2010-with-remote-powershell/