Microsoft

Unearth the Windows Experience Index in Windows 8.1 with PowerShell

Greg Shultz demonstrates how to use the RunWinSAT batch file and the DisplayWinSAT PowerShell script to display your Windows 8.1 system's Windows Experience Index scores.

Windows Experience Index

Do you remember the Windows Experience Index? It was a systems that was built into the Windows operating system since the Vista days that rated your system according to a number of factors and provided you with an overall score on a screen like the one shown in Figure A.

Figure A

Figure A

The Windows Experience Index made its debut in Windows Vista.

As you may remember, the ultimate goal of the Windows Experience Index was to make it easy to match software with the capabilities of a computer running Windows Vista. For example, a system with a Windows Experience Index base score of 3.0 will be able to optimally run any software that carries a Windows Experience Index rating of 3.0 and below. On the other hand, a system with a Windows Experience Index base score of 2.0 won't be able to satisfactorily run any software that carries a Windows Experience Index rating above 2.0.

Back in the Windows Vista days, the scale of the Windows Experience Index ranged from 1 to 5.9 and, of course, the higher the score for a particular component, the better performance you can expect from it.

Of course, the Windows Experience Index lived on in Windows 7, but since the tool never really caught on as Microsoft had imagined that it would, the tool essentially became a novelty. However, when Microsoft introduced Windows Experience Index, they stated that as technology became more sophisticated, the index would expand to accommodate faster hardware. So, in Windows 7, the maximum score was 7.9.

During the Windows 7 days, Microsoft hinted that for the next version of Windows, they would raise the maximum Windows Experience Index score to 8.9. Unfortunately, the Windows Experience Index never made it to Windows 8. The nice user interface that displayed the scores was removed from the operating system.

However, the utility that actually did all the heavy lifting for the Windows Experience Index, WinSAT.exe, is still a part of Windows 8.1, and it still works. Despite this, without the user interface, getting the scores for your system is difficult.

Of course, there are some shareware or freeware apps out there that can extract and display the Windows Experience Index, and they work pretty well. Being a DIY kind of guy, I decided to see if I could use PowerShell to display the Windows Experience Index score in Windows 8.1. It took a while to figure out and involved some crafty coding, but I got it to work. In this article, I'll describe how it works and show you how to get the Windows Experience Index score for your Windows 8.1 system.

Note: If you're going to be running WinSAT on a Windows 8.1 laptop, you must have the laptop plugged in — WinSAT will not run on a laptop that is operating on battery power.

Using WinSAT

As I mentioned, the behind-the-scenes analysis for the Windows Experience Index is performed by the Windows System Assessment Tools (or WinSAT for short). When you run WinSAT, it performs a host of stress tests on the main hardware components in your system, such as CPU, RAM, and video. As it runs these tests, WinSAT compiles the results in a number of extremely detailed XML files that it then saves in the C:\ Windows\performance\winsat\datastore folder.

If you open a Command Prompt window and enter the command winsat /? you'll discover that the WinSAT tool actually has a ton of parameters and switches that allow you to delve into a wide variety of assessments. However, for the purposes of this technique, we'll only use a few of them.

To begin with, we'll use the formal assessment parameter, which will run the full set of WinSAT assessments and generate the Windows Experience Index scores. We'll follow that with the -xml switch, which will allow us to specify a custom name for the main XML output file. Doing so will make it easier to extract the necessary information in PowerShell. Thus, our WinSAT command line will look like this:

Winsat formal -xml MyWinSATScore.xml

To construct a fully functioning tool, we'll host our WinSAT command line in a batch file called RunWinSAT.bat (Figure B), which will also include a change directory command and an automated house cleaning feature. You can download this batch file using the link below.

Figure B

Figure B

The RunWinSAT batch file runs the WinSAT command and performs some housecleaning duties.

Using PowerShell

Because PowerShell can interpret and parse XML files, it's the perfect tool to extract the Windows Experience Index scores from the very detailed XML file created by WinSAT. In order to read to XML file, we'll use the Get-Content command. As its name implies, the Get-Content command simply reads in the contents of a file. We'll then assign the contents of the file to a variable so that we can easily access it. We must preface the $winsat variable name with [xml] in order to signify to PowerShell that the variable will be holding XML data. Thus, our Get-Content command line will look like this:

[xml]$winsat=Get-Content MyWinSATScore.xml

Now, in order to be able to extract the Windows Experience Index scores, we have to know where in the XML file they are located. Fortunately, the scores end up at the very beginning of the XML file enclosed in the <WinSPR> tags (Figure C).

Figure C

Figure C

WinSAT stores the Windows Experience Index scores in an XML file.

Even better is the fact that in order to extract the information from an XML file with PowerShell, all you have to know are the outer and inner element or tag names. As you can see, the outer tag is <WinSAT> and the inner tag is <WinSPR>. As such, the command to extract and display the Windows Experience Index scores looks like this:

$winsat.WinSAT.WinSPR

To construct a fully functioning tool, we'll host our commands in a PowerShell script called DisplayWinSAT.ps1 (Figure D), which will also include a change directory command. You can download this PowerShell script and the batch file here.

Figure D

Figure D

The DisplayWinSAT script reads the XML file and extracts the Windows Experience Index scores.

Obtaining your Windows Experience Index scores

With the batch file and PowerShell script in hand, getting your Windows Experience Index scores is an easy procedure. To begin, you'll right-click on the RunWinSAT batch file and select Run as administrator from the context menu (Figure E). If you don't run the batch file in administrative mode, the command will fail.

Figure E

Figure E

You must run the RunWinSAT batch file from an administrative account.

You'll need to be patient, because the WinSAT command will take several minutes to run through all the tests. Once the RunWinSAT batch file is finished, you can run the PowerShell script from the PowerShell ISE.

To do so, press [Windows]+[S] to launch Search, and then type PowerShell ISE in the search box. Next, select PowerShell ISE from the results pane. Once PowerShell is up and running, pull down the File menu to locate and open the DisplayWinSAT.ps1. Just click the RunScript button or press [F5]. As soon as you do, PowerShell will extract and display the Windows Experience Index scores (Figure F).

Figure F

Figure F

Running the script in PowerShell ISE easily displays your Windows Experience Index scores.

What's your take?

Have you wondered about your Windows 8.1 system's Windows Experience Index scores? Will you use the RunWinSAT batch file and the DisplayWinSAT PowerShell script to find out? Share your opinion in the discussion thread below.

About Greg Shultz

Greg Shultz is a freelance Technical Writer. Previously, he has worked as Documentation Specialist in the software industry, a Technical Support Specialist in educational industry, and a Technical Journalist in the computer publishing industry.

Editor's Picks

Free Newsletters, In your Inbox