Hi all,

i have an issue regarding the on start ("-command")option of the
Powershell service for Scripting Driver.
What i would like to do is start the service with Exchange 2013 CMDLets
already present. Basically the shell you get when you start the
"Exchange Management Shell" that comes with the exchange tools.

Currently we do this like this:

-command import-module activeDirectory; $EXSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri "http://~servername~/Powershell";Import-PSSession $EXSession

This works most of the time but is sometimes extremely nasty when it
comes to the type of returned variables. What is extremely annoying is
that in this session setting Sting values with whitespaces is extremely
hard since apparently the quotes are interpreted when the remoting is

I have researched a bit and found out that the "Exchange Management
Shell" link does nothing other than execute the following command

C:\Windows\System32\WindowsPowerShell\v1.0\powersh ell.exe -noexit -command ". 'C:\Program Files\Microsoft\Exchange Server\V15\bin\RemoteExchange.ps1'; Connect-ExchangeServer -auto -ClientApplication:ManagementShell "

When i try to start the service with the same options for "-command" as
the link the service will come up but it will not know any Exchange
CMDLet. I have noticed that starting the service with this command will
take roughly the same amount of time as starting the Exchange Mangement
Shell. So i guess that there is a session started with the correct
options but is then closed immediately after.

Has anyone of you solved this problem already or an idea on how to
achieve this?

Best Regards Felix

fwitt's Profile: https://forums.netiq.com/member.php?userid=8759
View this thread: https://forums.netiq.com/showthread.php?t=52434