title: Getting the CPU, memory usage and free disk space using powershell
body: <p>Could you help me combine these three scripts to a format that's like this</p>
  
  <pre><code>ComputerName     CPUUsageAverage    MemoryUsage    C PercentFree
  xxx                           12            50%              30%
  </code></pre>
  
  <p>The way I execute this is:
  <code>Get-content '.\servers.txt' | Get-CPUusageAverage</code></p>
  
  <p>Here are the scripts:</p>
  
  <p>CPU</p>
  
  <pre><code>Function Get-CPUusageAverage
  {
  $input|Foreach-Object{Get-WmiObject -computername $_ win32_processor | Measure-Object -property LoadPercentage -Average | Select Average}
  }
  </code></pre>
  
  <p>Memory</p>
  
  <pre><code>    Function get-MemoryUsage
  {
  $input|Foreach-Object{
  gwmi -Class win32_operatingsystem -computername $_ |
  Select-Object @{Name = "MemoryUsage"; Expression = { “{0:N2}” -f ((($_.TotalVisibleMemorySize - $_.FreePhysicalMemory)*100)/ $_.TotalVisibleMemorySize) }
  }
  }
  }
  </code></pre>
  
  <p>C PercentFree</p>
  
  <pre><code>Function get-CPercentFree
  {
  $input|ForEach-Object{
    Get-WmiObject -Class win32_Volume -ComputerName $_ -Filter "DriveLetter = 'C:'" |
    Select-object @{Name = "C PercentFree"; Expression = { “{0:N2}” -f (($_.FreeSpace / $_.Capacity)*100) } }
   } 
   }
  </code></pre>