title: New-PSSession Parellel Execution
body: <p>We have two PSSessions that need to be established and imported into the current session before our script can continue.  Both steps require about 10 - 15 seconds each for a total of 20 - 30 seconds when run in series.</p>
  
  <p>Is it possible to run New-PSSession in a separate runspace and then somehow import that established session into the parent process?</p>
  
  <p>For example change from this:</p>
  
  <pre><code>New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri ("https://$($service)/PowerShell/") -Credential $Credential -Authentication Basic -AllowRedirection -ErrorAction Stop
  
  New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri "https://outlook.office365.com/powershell-liveid/" -Credential $Credential -Authentication Basic -AllowRedirection -ErrorAction Stop
  </code></pre>
  
  <p>To possibly something like this (warning this doesn't work):</p>
  
  <pre><code>$credential = Get-Credential
  
  $scriptblock = 
  {
         param ([string]$Credential)
  
         $session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri "https://outlook.office365.com/powershell-liveid/" -Credential $Credential -Authentication Basic -AllowRedirection -ErrorAction Stop
         return $session
  }
  
  
  $shell = [PowerShell]::Create().AddScript($scriptblock).AddParameter($credential)
  
  $job = $shell.BeginInvoke()
  $result = $shell.EndInvoke($job)
  
  Import-PSSession $result
  </code></pre>
  
  <p>The ultimate goal is to make this take less time, the idea being if we use New-PSSession in parallel it completes in 10 - 15 seconds instead of 20 - 30 seconds in series.  I'd be happy with any answer that accomplishes this, it doesn't need to be using runspaces.</p>
  
  <p>EDIT: Added goals</p>