How to remotely check the status of a web application pool with PowerShell?

You can use Invoke-Command to invoke the Get-WebAppPoolState cmdlet on the remote machine.

$appPoolStatus = Invoke-Command -ComputerName RemoteHostName {Import-Module WebAdministration; Get-WebAppPoolState DefaultAppPool}
$appPoolStatus.Value

Note that if you are going to use variables defined locally on the calling machine, you will have to treat them according to the rules. This link is an excellent post explaining them:

http://blogs.msdn.com/b/powershell/archive/2009/12/29/arguments-for-remote-commands.aspx

Example:

$appPoolName = "SomeAppPoolName"
$appPoolStatus = Invoke-Command -ComputerName RemoteHostName { param($apn) Import-Module WebAdministration; Get-WebAppPoolState $apn} -Args $appPoolName

You can use this if you want pretty out:

Invoke-Command -ComputerName RemoteHostName -ScriptBlock { Get-WebAppPoolState | % {  return  @{($_.itemxpath -split ("'"))[1]="$($_.value)" } }}