title: Check the AppPool status through power-shell and start that on remote machine
body: <p>The requirement is to extract the server name one by one and check the AppPool status, if that is found to be stopped, make it running. below code is not helping out.</p>
  
  <pre><code>$ErrorActionPreference = "Continue"
  $status = gc -path "D:\Servers\server.txt"|ForEach-Object (invoke-command -ComputerName $_ -ScriptBlock {Import-Module Webadministration Get-WebAppPoolState -name (gc "D:\AppPool.txt")})
  
  if ($status.value -eq "Started") 
  {
      Write-Host ("ApppPool already running")
  }
  else 
  {
      Invoke-Command -ScriptBlock {Start-WebAppPool}
      Write-host ("AppPool has started successfully") 
  }
  </code></pre>