2 回答

TA貢獻(xiàn)1808條經(jīng)驗(yàn) 獲得超4個贊
WMI 系統(tǒng)有一個存儲該數(shù)據(jù)的類。[grin] 你可以調(diào)用它,要么直接使用生成的對象,要么構(gòu)建一個只有你想要的東西的對象。
它的作用...
使用 CIM 內(nèi)容訪問指定系統(tǒng)的 WinSAT 信息
計(jì)算評級的平均值
構(gòu)建一個來保存該信息
PSCustomObject
顯示信息
代碼 ...
$CIM_WinSAT = Get-CimInstance -ClassName Win32_WinSAT -ComputerName $env:COMPUTERNAME
$Average_WinSAT = ($CIM_WinSAT.PSObject.Properties.Where({$_ -match 'score'}).Value |
Measure-Object -Average).Average
$WinSAT_Info = [PSCustomObject]@{
ComputerName = $CIM_WinSAT.PSComputerName
Perf_WinExp_Average = '{0:N2}' -f $Average_WinSAT
Perf_WinExp_All = $CIM_WinSAT.WinSPRLevel
Perf_WinExp_CPU = $CIM_WinSAT.CPUScore
Perf_WinExp_RAM = $CIM_WinSAT.MemoryScore
Perf_WinExp_Disk = $CIM_WinSAT.DiskScore
Perf_WinExp_Vid = $CIM_WinSAT.GraphicsScore
Perf_WinExp_Vid_D3D = $CIM_WinSAT.D3DScore
}
$WinSAT_Info
輸出。。。
ComputerName : [MySysName]
Perf_WinExp_Average : 7.02
Perf_WinExp_All : 6.5
Perf_WinExp_CPU : 7.3
Perf_WinExp_RAM : 7.3
Perf_WinExp_Disk : 7.5
Perf_WinExp_Vid : 6.5
Perf_WinExp_Vid_D3D : 6.5
添加回答
舉報