How to create multiple PSSession to exchange management shell

Welcome Forums General PowerShell Q&A How to create multiple PSSession to exchange management shell

Viewing 0 reply threads
  • Author
    Posts
    • #281758
      Participant
      Topics: 11
      Replies: 11
      Points: 130
      Rank: Participant

      Hi

      I am trying to create multiple PSSession to exchange management shell. I can’t figure out how to get this done. The code below is

      $ScriptDir = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
      $Serverlist = @(get-content -Path "$ScriptDir\serverlist.txt")

      foreach ($Server in $Serverlist) {
      $UserCredential = Get-Credential
      $MySession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://$Server.globalnet.lcl/PowerShell/ -Authentication Kerberos -Credential $UserCredential
      Import-PSSession $MySession
      Get-MailboxDatabaseCopyStatus | Select-Object Name, Status, activationpreference | Format-Table -AutoSize
      }

      Get-PSSession | Remove-PSSession

       

      • This topic was modified 4 weeks, 1 day ago by mrdon03.
      • This topic was modified 4 weeks, 1 day ago by mrdon03.
Viewing 0 reply threads
  • You must be logged in to reply to this topic.