I want to Run Exchange Management shell using Start Process

Hey Guyz,

I’m automating the AD creation using UI path. When I run the command to set the Attributes using PowerShell in start Process by passing the .exe of the PowerShell It works fine.

But the Challenge here is for Exchange Management PowerShell .


It does not contain the .exe file. when I tried to get the .exe location.
Capture
It was giving the exact powershell.exe location.
Capture2
and this was the Target of the Exchange Management shell.

Target : [ C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noexit -command “. ‘C:\Program Files\Microsoft\Exchange Server\V15\bin\RemoteExchange.ps1’; Connect-ExchangeServer -auto -ClientApplication:ManagementShell”]

thanks in advance.:grinning:

Regards,
Nizam

Hello @Ahmed_Nizamuddin,
It looks like this shortcut is normal PowerShell executable file with parameters (which are in fact a command PS command executed after importing RemoteExchange.ps1 module). I think you could just make you own script .ps1 script like:

  1. Import-Module “C:\Program Files\Microsoft\Exchange Server\V15\bin\RemoteExchange.ps1”
  2. Connect-ExchangeServer -auto -ClientApplication:ManagementShell

Then invoke this script using Invoke Power Shell activity.

1 Like

Thank you for the Reply but when I execute this in powershell activity it throws
error