title: Powershell: Get-service check running or not running
body: <p>I have the following problem:</p>
  
  <p>When I use:</p>
  
  <pre><code>Get-Service -Name CcmExec -ErrorAction silentlycontinue
  </code></pre>
  
  <p>I get the follow list:</p>
  
  <pre><code>Status   Name               DisplayName
  ------   ----               -----------
  Running  CcmExec            SMS Agent Host
  </code></pre>
  
  <p>or</p>
  
  <pre><code>Status   Name               DisplayName
  ------   ----               -----------
  Stopped  CcmExec            SMS Agent Host
  </code></pre>
  
  <p>When I use</p>
  
  <pre><code>$service = Get-Service -Name CcmExec -ErrorAction silentlycontinue -ComputerName $Computername
  write-host "$service" 
  </code></pre>
  
  <p>I only see ccmexec but not "running' or stoppend".</p>