connecting to exchange

Welcome Forums General PowerShell Q&A connecting to exchange

This topic contains 6 replies, has 2 voices, and was last updated by

 
Participant
2 years ago.

  • Author
    Posts
  • #59892

    Participant
    Points: 64
    Rank: Member

    Hello,

    I need to create email accounts in powershell. I know how to create them using exchange shell, but how would I do it from "regular" powershell? The -ConfigurationName and -ConnectionUri are correct. We're using Exchange 2013.

    Is there a import module for exchange like Import-Module ActiveDirectory?

    $Exchange = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://webmail.companyname.com/PowerShell/

    if I do

    New-PSSession -ComputerName HQVEX01

    , it opens the session

    Thank you,

    Tony

  • #59895

    Participant
    Points: 35
    Rank: Member

    Give this a go, remoting etc.. will need to be enabled on the other end

    
    $Username = "Domain\User.Name"
    	$Password = ConvertTo-SecureString "Password" -AsPlainText -Force
    	$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $password
    	
    	$SESJA_EX = New-PSSession -Credential $cred -ConnectionUri http://Exhchangeserver/powershell -ConfigurationName microsoft.exchange
    	Import-PSSession $SESJA_EX
    
    
  • #59896

    Participant
    Points: 64
    Rank: Member

    Thanks Mark,

    If I'm running powershell already as as admin, do I still need the $Username and $Password?

    • #59901

      Participant
      Points: 35
      Rank: Member

      yep as your importing a session,

  • #59899

    Participant
    Points: 64
    Rank: Member

    I'm getting

    WinRM cannot process the request. The following error occurred while using Kerberos authentication: Cannot find
    the computer webmail.marinerfinance.com. Verify that the computer exists on the network and that the name provided is spelled correctly. For more information, see the about_Remote_Troubleshooting Help topic.

  • #59904

    Participant
    Points: 35
    Rank: Member

    take a look at WRM on you machine an make sure kerbos is enabled also ps remoting

    https://msdn.microsoft.com/en-us/powershell/reference/5.1/microsoft.powershell.core/enable-psremoting

  • #59911

    Participant
    Points: 64
    Rank: Member

    Thanks Mark, I'll try that

The topic ‘connecting to exchange’ is closed to new replies.