Exchange Powershell - How to invoke Exchange 2010 module from inside script?

前端 未结 3 863
有刺的猬
有刺的猬 2021-01-02 05:36

I\'m writing a script that does a number of things with AD and Exchange and just got to the part of the GUI where I need to start working with Exchange but don\'t see where

3条回答
  •  无人及你
    2021-01-02 06:15

    I know this is an old question, but rather than adding the snapin which is apparently unsupported, I just looked at the EMS shortcut properties and copied those commands.

    The full shortcut target is:

    C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noexit -command ". 'C:\Program Files\Microsoft\Exchange Server\V14\bin\RemoteExchange.ps1'; Connect-ExchangeServer -auto"
    

    So I put the following at the start of my script and it seemed to function as expected:

    . 'C:\Program Files\Microsoft\Exchange Server\V14\bin\RemoteExchange.ps1'
    Connect-ExchangeServer -auto
    

    Notes:

    • Has to be run in 64bit PS
    • This was tested on a server with just the Management Tools installed. It automatically connected to our existing Exchange infrastructure.
    • No extensive testing has been done, so I do not know if this method is viable. I will edit this post if I run into any issues.

提交回复
热议问题