Pssession 'persistant'

This topic contains 7 replies, has 2 voices, and was last updated by Profile photo of Dan Potter Dan Potter 1 month, 1 week ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #51607
    Profile photo of Vincent Nunnari
    Vincent Nunnari
    Participant

    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

    #51612
    Profile photo of Dan Potter
    Dan Potter
    Participant

    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.

    #51615
    Profile photo of Dan Potter
    Dan Potter
    Participant

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

    #51626
    Profile photo of Vincent Nunnari
    Vincent Nunnari
    Participant

    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?

    #51632
    Profile photo of Vincent Nunnari
    Vincent Nunnari
    Participant

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

    #51662
    Profile photo of Dan Potter
    Dan Potter
    Participant

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

    #51708
    Profile photo of Vincent Nunnari
    Vincent Nunnari
    Participant

    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! 🙂

    #51745
    Profile photo of Dan Potter
    Dan Potter
    Participant

    Yep, it's called implicit remoting.

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

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.