Retrieving Windows Experience Index via WMI

You may have seen this on your Vista or Windows 7 machine. As you can tell, mine is probably average, but did you know that you can retrieve this locally or remotely via WMI using the Win32_WinSat class?

You can not only retrieve that number but all of the scores that you would normally see via the GUI (see below).

This little function will allow you to view not only your local Windows Experience Index, but also any remote machine’s index as well! The big thing that I changed was translating the value that you would normally get with the AssessmentState property.

PS C:\Users\boe\Downloads> get-winsat -computer “boe-laptop”,”dc1″ | FT -autoComputer   CPU VideoCard PhysicalDisk Graphics Memory WinSPRLevel AssessmentState
——–   — ——— ———— ——– —— ———– —————
boe-laptop 5.1       6.1          5.5      5.3    5.1         5.1 Valid
dc1        N/A       N/A          N/A      N/A    N/A         N/A OS Not Supported

Script posted on the Technet Script Repository

function Get-WinSat{
<#
.SYNOPSIS
Retrieves Windows Experience Index information.
.DESCRIPTION
Retrieves Windows Experience Index information.
.PARAMETER computer
Name of server to retrieve Windows Experience Information.
.NOTES
Name: Get-WinSat
Author: Boe Prox
DateCreated: 20SEPT2010.LINK


https://boeprox.wordpress.org
.EXAMPLE
Get-WinSat -computer “test”
#>
[cmdletbinding(
DefaultParameterSetName = ‘computer’,
ConfirmImpact = ‘low’
)]
Param(
[Parameter(
Mandatory = $True,
Position = 0,
ParameterSetName = ‘computer’,
ValueFromPipeline = $True)]
[array]$computer
)
Begin {
#Create empty array
[array]$report = @()
}
Process {
#Iterate through computers
ForEach ($c in $computer) {
#Create temp object
$temp = New-Object PSObject
#Continue if OS is Vista or above
If ((Get-WmiObject -ComputerName $c Win32_OperatingSystem).version -gt 5.3) {
Try {
#Retrieve Windows Experience Index information
$winsat = gwmi win32_winsat -comp $c -ea stop
$temp | Add-Member NoteProperty Computer  $c
$temp | Add-Member NoteProperty CPU  $winsat.CPUScore
$temp | Add-Member NoteProperty VideoCard  $winsat.D3DScore
$temp | Add-Member NoteProperty PhysicalDisk  $winsat.Diskscore
$temp | Add-Member NoteProperty Graphics  $winsat.GraphicsScore
$temp | Add-Member NoteProperty Memory  $winsat.MemoryScore
$temp | Add-Member NoteProperty WinSPRLevel  $winsat.WinSPRLevel
Switch ($winsat.WinSATAssessmentState) {
0 {$assessment = “StateUnknown”}
1 {$assessment = “Valid”}
2 {$assessment = “IncoherentWithHardware”}
3 {$assessment = “NoAssessmentAvailable”}
4 {$assessment = “Invalid”}
}
$temp | Add-Member NoteProperty AssessmentState $assessment
}
Catch {
$temp | Add-Member NoteProperty Computer  $c
$temp | Add-Member NoteProperty CPU  “N/A”
$temp | Add-Member NoteProperty VideoCard  “N/A”
$temp | Add-Member NoteProperty PhysicalDisk “N/A”
$temp | Add-Member NoteProperty Graphics  “N/A”
$temp | Add-Member NoteProperty Memory “N/A”
$temp | Add-Member NoteProperty WinSPRLevel  “N/A”
$temp | Add-Member NoteProperty AssessmentState “Unable to query value”
}
}
Else {
$temp | Add-Member NoteProperty Computer  $c
$temp | Add-Member NoteProperty CPU  “N/A”
$temp | Add-Member NoteProperty VideoCard  “N/A”
$temp | Add-Member NoteProperty PhysicalDisk “N/A”
$temp | Add-Member NoteProperty Graphics  “N/A”
$temp | Add-Member NoteProperty Memory “N/A”
$temp | Add-Member NoteProperty WinSPRLevel  “N/A”
$temp | Add-Member NoteProperty AssessmentState “OS Not Supported”
}
#Add temp object to report array
$report += $temp
}
}
End {
#Display report
$report
}
}

About Boe Prox

Microsoft Cloud and Datacenter MVP working as a SQL DBA.
This entry was posted in powershell, scripts and tagged , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s