title: enter-pssession invoke-command, when to use?
body: <p>I am writing a script to stop and start services in two remote servers.
  Here's my question,</p>
  
  <p>in my script I did new-pssession and used invoke-command to stop and start services.</p>
  
  <p>Do I need to use enter-pssession? </p>
  
  <p><strong>Updates:</strong>
  Here's what my script needs to do.  </p>
  
  <p>on server1, I need to stop and start two services.
  on server2, I need to stop and start just one service. </p>
  
  <pre><code># foreach for server 1 since I need to stop and start two services. created a session for server 1
  foreach($service in $services){
  
      $session = New-PSSession -ComputerName $serverName -Credential $cred
      Invoke-Command -Session $session -ScriptBlock {param($service) Stop-Service -Name $service} -ArgumentList $service
      remove-pssession -session $session
  
  }
  
  # created a session for server 2. I need to stop and start just one service in server 2
  $session = New-PSSession -ComputerName $serverName -Credential $cred
  Invoke-Command -Session $session -ScriptBlock {param($service) Stop-Service -Name $service} -ArgumentList $service
  remove-pssession -session $session
  </code></pre>
  
  <p>is this the right way to do it?</p>