Author Posts

August 23, 2016 at 12:40 pm

Hi Guys,

Into one "command prompt" :
I'am connecting my local computer to a MICROSOFT EXCHANGE SERVER by doing a "New-pssession"
Then, iam getting all the COMMANDS on the local machine by doing a "Import-pssession".
So, i can use all the CMDLET to interact with MICROSOFT EXCHANGE.
Also, if iam doing a "get-pssession" i can the PSSESSION is returned with few informations.

The problem is the following !
i open a new "command prompt" :
I try to catch the existing PSSESSION by doing a "get-pssession".
(but nothing is retured)

Why? Is there any possibility to catch an existing PSSESSION by opening a new powershell process?
hope you can help
Vinz

August 23, 2016 at 12:58 pm

If you're talking on-prem exchange than just install the module.

For cloud use export-pssession to save the cmdlets locally. I would get in the habit of updating the module regularly though, Microsoft isn't going to let you know when they change.

August 23, 2016 at 1:07 pm

Export-PSSession $Session -OutputModule ExchangeOnline -Force -AllowClobber

August 23, 2016 at 2:04 pm

This is how i'am connecting :
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://xxxxxxxxxxx.domain/powershell/ -Authentication Kerberos -Credential $mycreds -Name $sessionName

Let me explain my project :
– A PHP WEB application running on a WINDOWS APACHE webserver is executing a local powershell script each time you click on a button. This script is connecting to EXCHANGE and can also create/delete/modify a mailbox into exchange.
So, each time a button is clicked, a new POWERSHELL process is launched, and a new connexion between the local server and the Exchange server is done. This is bad, and too slow... i want the script to catch an existant connexion so we do not have to connect again and to load all the CMDLET..

How can i do?

August 23, 2016 at 2:16 pm

Also, this is "on premise" exchange.
What is the module you're talking about?

August 23, 2016 at 4:15 pm

Get the exchange installation files and install the management tools only.

August 24, 2016 at 6:49 am

I did it.
I still cannot retrieve a PSSESSION from another prompt.
But thanks to you, i don't not need anymore to import all the MSEXCH CMDLET, it's a powerfull gain of time.
Thanks a lot! 🙂

August 24, 2016 at 12:58 pm

Yep, it's called implicit remoting.

Very helpful to know what the difference is especially if you start working in the cloud.