# encoding: ascii
# api: powershell
# title: Get-WindowsExperience
# description: Get the Windows Experience Rating
# version: 0.1
# type: function
# author: Joel Bennett
# license: CC0
# function: Get-WindowsExperienceRating
# x-poshcode-id: 2961
# x-derived-from-id: 2962
# x-archived: 2011-11-05T17:18:18
# x-published: 2011-09-21T09:52:00
#
#
function Get-WindowsExperienceRating {
#.Synopsis
#  Gets the Windows Experience Ratings
#.Parameter ComputerName
#  The name(s) of the computer(s) to get the Windows Experience (WinSat) numbers for.
[CmdletBinding()]
param(
  [Parameter(ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true)]
  [string[]]$ComputerName='localhost'
)
process {
  Get-WmiObject -ComputerName $ComputerName Win32_WinSAT | ForEach-Object {
     if($_.WinSatAssessmentState -ne 1) {
        Write-Warning "WinSAT data for '$($_.__SERVER)' is out of date ($($_.WinSatAssessmentState))"
     }
     $_
  } | Select-Object -Property @{name="Computer";expression={$_.__SERVER}}, *Score #, WinSPRLevel
}
}
