#Run this as administrator # delete old report contents del c:\windows\performance\winsat\datastore\*.xml #Run system experience with this command: winsat formal # find output file and obtain data needed $outputpath = dir c:\windows\performance\winsat\datastore | sort-object {$_.LastWriteTime} -Descending | select-object -First 1 | select-object -property fullname $outputpath = Split-Path $outputPath -leaf # $outputpath now has the filename only minus the extension, need to add it: $outputpath = $outputpath + '.xml' $outputpath = 'c:\windows\performance\winsat\datastore\' + $outputpath # get the correct file: cd \Windows\Performance\WinSAT\DataStore\ $outputpath = Get-ChildItem | Where-Object { $_.Name -match 'Formal' } $outputpath = Split-Path $outputPath -leaf # $outputpath now contains only the filename # Get scores from file and print to screen # Write-Host "" Write-Host -NoNewLine "Overall system score is " Select-XML -Path $outputpath -XPath '/WinSAT/WinSPR/SystemScore' | ForEach-Object { $_.Node.InnerXML } Write-Host -NoNewLine "Memory Score is " Select-XML -Path $outputpath -XPath '/WinSAT/WinSPR/MemoryScore' | ForEach-Object { $_.Node.InnerXML } Write-Host -NoNewLine "CPU score is " Select-XML -Path $outputpath -XPath '/WinSAT/WinSPR/CpuScore' | ForEach-Object { $_.Node.InnerXML } Write-Host -NoNewLine "Grapics score is " Select-XML -Path $outputpath -XPath '/WinSAT/WinSPR/GraphicsScore' | ForEach-Object { $_.Node.InnerXML } Write-Host -NoNewLine "Gaming system score is " Select-XML -Path $outputpath -XPath '/WinSAT/WinSPR/GamingScore' | ForEach-Object { $_.Node.InnerXML } Write-Host -NoNewLine "Disk score is " Select-XML -Path $outputpath -XPath '/WinSAT/WinSPR/DiskScore' | ForEach-Object { $_.Node.InnerXML } # Write data to a file Write-Host "" $SystemScore = Select-XML -Path $outputpath -XPath '/WinSAT/WinSPR/SystemScore' | ForEach-Object { $_.Node.InnerXML } $SystemScore = "Overall system score is " + $SystemScore > report.txt Write-Host "" $MemoryScore = Select-XML -Path $outputpath -XPath '/WinSAT/WinSPR/MemoryScore' | ForEach-Object { $_.Node.InnerXML } $MemoryScore = "Memory score is " + $MemoryScore >> report.txt Write-Host "" $CpuScore = Select-XML -Path $outputpath -XPath '/WinSAT/WinSPR/CpuScore' | ForEach-Object { $_.Node.InnerXML } $CpuScore = "CPU score is " + $CPUScore >> report.txt Write-Host "" $GraphicsScore = Select-XML -Path $outputpath -XPath '/WinSAT/WinSPR/GraphicsScore' | ForEach-Object { $_.Node.InnerXML } $GraphicsScore = "Grapics score is " + $GraphicsScore >> report.txt Write-Host "" $GamingScore = Select-XML -Path $outputpath -XPath '/WinSAT/WinSPR/GamingScore' | ForEach-Object { $_.Node.InnerXML } $GamingScore = "Gaming score is " + $GamingScore >> report.txt Write-Host "" $DiskScore = Select-XML -Path $outputpath -XPath '/WinSAT/WinSPR/DiskScore' | ForEach-Object { $_.Node.InnerXML } $DiskScore = "Disk score is " + $DiskScore >> report.txt # #Rename file with creation date and time Get-ChildItem *.txt | Rename-Item -newname {$_.CreationTime.toString("MM.dd.yyyy.HH.mm") + "-WinSAT Report" + ".txt"} Write-Host "" PAUSE