Connecting to Exchange2010 powershell not importing all the commands

Welcome Forums General PowerShell Q&A Connecting to Exchange2010 powershell not importing all the commands

This topic contains 0 replies, has 1 voice, and was last updated by  dangoodwin41 3 months ago.

  • Author
    Posts
  • #166175

    Participant
    Topics: 2
    Replies: 0
    Points: 23
    Rank: Member

    Hi,

    I am trying to create this powershell module to enable me to connect to our exchange 2010 server via powershell.

    Below is what is in the module script file (.psm1):

    Function Connect-ExchangeOnPrem {
    
    $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://server.company.co.uk/PowerShell -Authentication Kerberos -Credential dgoodwin
    
    Import-PSSession $Session -DisableNameChecking -AllowClobber
    
    }

     

    When I import this module into PowerShell then run Connect-ExchangeOnPrem, I get the error shown in the link which contains a screenshot:

    https://ibb.co/FmsL67B

    However, if I was to run the commands in the module script manually, it connects to the exchange server without any issues.

    Can anyone see anything wrong with my script or what could be the issue here?

    Thanks,

    Dan

     

The topic ‘Connecting to Exchange2010 powershell not importing all the commands’ is closed to new replies.