PowerShell一站式检测系统-硬件-驱动,跑分,附函数模组示例 更新27
❀原创教程,转载本页必须注明链接和作者
❀目前本文档处于发布晚期,代码很稳~
这套PowerShell命令行属于基础难度,方便修改,而且执行起来不比现有的软件系统检测慢。换了硬件可以拿来跑一遍跑个分,查看硬件信息,查询序列号,自带汉化,稍微改改还可以远程在别的计算机上生成报告。下面正式开始教程(っ╹◡╹)ノ
使用前,要在设置-->更新和安全-->开发者选项中解除PowerShell的运行限制,如图:
代码如下,拷下来用Unicode/UTF-8编码保存为`系统检测.ps1`运行即可(⊙_◎):
clear
"建议全屏运行. Running under maxized window is preferred.`r`n含独立显卡的笔记本电脑会于低能耗模式下断其电源, 需切换核显到独显才能检测到独显.`r`nLaptop w/ may cut power to discrete GPU for power-saving, detection may requires switching from iGPU to GPU"
"`r`n以 `"Powershell -noexit "+($pwd.Path)+"\Get-MyPC.ps1`" 运行本脚本以保留交互窗口可用`r`nRun with `"Powershell -noexit "+($pwd.Path)+"\Get-MyPC.ps1`" if user prompts upon script completion is preferred."
$ErrorActionPreference = "Stop"
"`r`n检测日期: {0:dddd, MMMM dd, yyyy, UTCzzz}" -f (Get-Date) + "`r`n计算机名: "+$env:computername+", "+(Get-WmiObject -class Win32_OperatingSystem).Caption
if (($host.name -match 'consolehost')) { #PowerShell窗口
$oWidth = gwmi win32_videocontroller | select-object CurrentHorizontalResolution -first 1
$oHeight = gwmi win32_videocontroller | select-object CurrentVerticalResolution -first 1
"主显示器宽: "+(([Convert]::ToInt32($oWidth.CurrentHorizontalResolution)))
"主显示器高: "+(([Convert]::ToInt32($oHeight.CurrentVerticalResolution)))
"`r`n√ 运行于PowerShell Console窗口中"
}
else { #PowerShell ISE窗口
"主显示器宽: "+([System.Windows.Forms.SystemInformation]::PrimaryMonitorSize.Width)
"主显示器高: "+([System.Windows.Forms.SystemInformation]::PrimaryMonitorSize.Height)
"`r`n√ 运行于PowerShell ISE窗口中"
}
switch (Read-Host " `n运行系统跑分吗(耗时~5分钟,输入y或n后按Enter)") {
'y' {WinSat formal}
'n' {"跑分跳过!"}
default {"未输入条件!"}
}
#设定标题长28
[int]$tCenter = 28
"`n`n 系Windows`n 统`n 体Experience`n 验`n 跑Index`n 分(筛选最差)`n"
$ExpIdx = Get-CimInstance Win32_WinSat | Select CPUScore,D3DScore,DiskScore,GraphicsScore,WinSATAssessmentState,WinSPRLevel
#标题和居中计算
[string]$heading = "总分: "+$ExpIdx.WinSPRLevel
[int]$eCenter = $tCenter - $heading.Length/2
#输出标题和内容
"-"*$eCenter+$heading+"-"*$eCenter
($ExpIdx | Format-List @{l='处理器得分';e='CPUScore'},@{l='2D图形得分';e='GraphicsScore'},@{l='3D图形得分';e='D3DScore'},@{l='硬盘得分';e='DiskScore'} `
| Out-String).Trim()
"`n`n 主Mother`n 板board`n"
$MB = Get-WmiObject Win32_Baseboard | Select Product,Status,Manufacturer,Model,SerialNumber,Version
#标题和居中计算
[string]$heading = $MB.Product
[int]$eCenter = $tCenter - $heading.Length/2
#输出标题和内容
"-"*$eCenter+$heading+"-"*$eCenter
($MB | Format-List -OutVariable "Motherboard" @{l='状况';e='Status'},@{l='厂商';e='Manufacturer'},@{l='型号';e='Model'},@{l='序列号';e='SerialNumber'},@{l='REV版本';e='Version'} `
| Out-String).Trim()
#$Motherboard >> D:\Desktop\1.txt
"`n`n 中C`n 央P`n 处U`n 理`n 器`n"
$CPUCount=0
Get-CimInstance Win32_Processor | Select Availability,CurrentClockSpeed,MaxClockSpeed,Name,DeviceID,NumberOfCores,ThreadCount,LoadPercentage,VoltageCaps,VirtualizationFirmwareEnabled,L2CacheSize,L3CacheSize `
| ForEach-Object {#为多路处理器系统准备的循环
Switch ($_.Availability) {#区分设备运行与供电状态
2 {[string]$prState = "未知"}
3 {[string]$prState = "正常"}
8{[string]$prState = "脱机"}
4 {[string]$prState = "报警中"}
5 {[string]$prState = "处于测试状态"}
18{[string]$prState = "暂停中"}
11{[string]$prState = "未安装"}
12{[string]$prState = "安装错误"}
16{[string]$prState = "重新启动中"}
17{[string]$prState = "省电模式: 警告"}
13{[string]$prState = "省电模式: 未知"}
14{[string]$prState = "省电模式: 节能"}
15{[string]$prState = "省电模式: 待机"}
20{[string]$prState = "处理器缺少状态参数"}
21{[string]$prState = "反馈被阻止"}
Default{$prState = ($_.Availability).ToString()}
}
#标题和居中计算
[string]$heading = $_.DeviceID+": "+($_.Name).Trim()
[int]$eCenter = $tCenter - $heading.Length/2
#输出标题和内容
"-"*$eCenter+$heading+"-"*$eCenter
#即使是在pipe里的循环中也仍需为Format-List重新pipe一次
($_ | Format-List -ShowError -OutVariable "Processor$CPUCount" `
@{l='当前频率'; e=($_.CurrentClockSpeed).ToString()},
@{l='最大频率'; e=($_.MaxClockSpeed).ToString()},
@{l='状态'; e=$prState},
@{l='L2缓存'; e={($_.L2CacheSize*1KB / 1MB).ToString()+"MB"}},#原始数据为1KB, 而直接除以MB会按1B/1MB算
@{l='L3缓存'; e={($_.L3CacheSize*1KB / 1MB).ToString()+"MB"}},#所以先乘以1KB, 使其转换为1024B倍实现单位对齐, 再除以1MB
@{l='最大工作电压';e={($_.VoltageCaps / 1000).ToString()+"V"}},
@{l='当前负载'; e={($_.LoadPercentage).ToString()+"%" }},
@{l='虚拟化已开'; e={($_.VirtualizationFirmwareEnabled).ToString()}} `
| Out-String).Trim()
#$Processor0 >> D:\Desktop\1.txt; $Processor1 >> D:\Desktop\1.txt
$CPUCount+=1
}
"`n`n 内R`n 存A`n 条M`n"
$RAMCount=$GBpsCount=0
Get-WmiObject -Class Win32_PhysicalMemory | Select SMBIOSMemoryType,Manufacturer,ConfiguredVoltage,ConfiguredClockSpeed,BankLabel,MaxVoltage,PartNumber,Tag,Capacity,TotalWidth `
| ForEach-Object {#逐内存条显示信息的循环
Switch ($_.SMBIOSMemoryType) {
20{[string]$memType = "DDR"}
21{[string]$memType = "DDR2"}
22{[string]$memType = "DDR2 FB-DIMM"}
24{[string]$memType = "DDR3"}
26{[string]$memType = "DDR4"}
34{[string]$memType = "DDR5"}
0 {[string]$memType = "不可用(N/A)"}
1 {[string]$memType = "其它"}
2 {[string]$memType = "DRAM"}
{$_ -eq 3 -or $_ -eq 17} {[string]$memType = "同步内存/Synchronous DRAM/SDRAM"}
4 {[string]$memType = "其它缓存嵌入式内存/Cached DRAM"}
6 {[string]$memType = "处理器嵌入内存/Embedded DRAM/eDRAM"}
7 {[string]$memType = "图形内存/VRAM"}
8 {[string]$memType = "静态内存/非刷新内存/Static RAM/SRAM"}
{$_ -eq 9 -or $_ -eq 10} {[string]$memType = "只读存储/ROM"}
11{[string]$memType = "闪存/Flash"}
12{[string]$memType = "通电可编程只读存储/EEPROM"}
13{[string]$memType = "可编程只读闪存/FEPROM"}
14{[string]$memType = "可编程只读存储/EPROM"}
15{[string]$memType = "SRAM缓存嵌入式内存/CDRAM"}
16{[string]$memType = "3DRAM"}
18{[string]$memType = "同步接口图形内存/SGRAM"}
19{[string]$memType = "Rambus DRAM/RDRAM/RIMM"}
Default{$memType = ($_.SMBIOSMemoryType).ToString()}
}
#标题和居中计算
[string]$heading = $_.Tag+": "+($_.PartNumber).Trim()
[int]$eCenter = $tCenter - $heading.Length/2
#输出标题和内容
"-"*$eCenter+$heading+"-"*$eCenter
($_ | Format-List -OutVariable "Memory$RAMCount" `
@{l='频率'; e={($_.ConfiguredClockSpeed).ToString()+"MT/s (Mbps)"}},
@{l='厂商'; e='Manufacturer'},
@{l='容量'; e={($_.Capacity / 1GB).ToString()+"GB"}},
@{l='内存介质'; e={$memType}},
@{l='数据总线位宽';e={($_.TotalWidth).ToString()+"bit" }},
@{l='最大工作电压';e={($_.MaxVoltage / 1000).ToString()+"V"}},
@{l='当前工作电压';e={($_.ConfiguredVoltage / 1000).ToString()+"V"}},
@{l='理论最高带宽';e={($_.ConfiguredClockSpeed * $_.TotalWidth/8 / 1000).ToString()+"GB/s"}},
@{l='物理库(RANK)';e='BankLabel'} `
| Out-String).Trim()
#$Memory0 >> D:\Desktop\1.txt; $Memory2 >> D:\Desktop\1.txt
$GBpsCount+=$_.ConfiguredClockSpeed * $_.TotalWidth/8 / 1000
$RAMCount +=1
}
"`n 累积理论最高带宽:$GBpsCount GB/s 或 "+($GBpsCount*8)+" Gbps `n"
"`n`n B`n I`n O`n S`n"
$MBBIOS = Get-CimInstance Win32_BIOS | Select Status,Name,BIOSVersion,SMBIOSBIOSVersion,ReleaseDate
#标题和居中计算
[string]$heading = ($MBBIOS.BIOSVersion).Trim()
[int]$eCenter = $tCenter - $heading.Length/2
#输出标题和内容
"-"*$eCenter+$heading+"-"*$eCenter
($MBBIOS | Format-List -ShowError -OutVariable "BIOS" @{l='名称/版本';e='Name'},@{l='状况';e='Status'},@{l='发行日期';e={($_.ReleaseDate).ToString('yyyy-MM-d')}},@{l='系统用BIOS版本';e='SMBIOSBIOSVersion'} `
| Out-String).Trim()
#$BIOS >> D:\Desktop\1.txt
"注:MSI微星BIOS版号写作如7C91vA9的数字;其中vA9代表Version A.90或其它数字"
"`n`n 图G`n 形P`n 处U`n 理`n 器`n"
$GPUCount=0
Get-WMIObject -Class Win32_VideoController | Select DeviceID,Availability,Name,DriverVersion,DriverDate,VideoModeDescription,CurrentBitsPerPixel `
| ForEach-Object {#为多显卡系统准备的循环, 包括核显
if ($_.CurrentBitsPerPixel -eq $null) {$_.CurrentBitsPerPixel = 0} #ForEach-Object : 不能对 Null 值表达式调用方法
#区分设备运行与供电状态
Switch ($_.Availability) {
2 {[string]$prState = "未知"}
3 {[string]$prState = "正常"}
8 {[string]$prState = "脱机"}
4 {[string]$prState = "报警中"}
5 {[string]$prState = "处于测试状态"}
18{[string]$prState = "暂停中"}
11{[string]$prState = "未安装"}
12{[string]$prState = "安装错误"}
16{[string]$prState = "重新启动中"}
17{[string]$prState = "省电模式: 警告"}
13{[string]$prState = "省电模式: 未知"}
14{[string]$prState = "省电模式: 节能"}
15{[string]$prState = "省电模式: 待机"}
20{[string]$prState = "处理器缺少状态参数"}
21{[string]$prState = "反馈被阻止"}
Default{$prState = ($_.Availability).ToString()}
}
#标题和居中计算
[string]$heading = $_.DeviceID+": "+$_.Name
[int]$eCenter = $tCenter - $heading.Length/2
#输出标题和内容
"-"*$eCenter+$heading+"-"*$eCenter
#即使是在pipe里的循环中也仍需为Format-List重新pipe一次
($_ | Format-List -ShowError -OutVariable "GraphicsCard$GPUCount" `
@{l='状态'; e={$prState}}, #String
@{l='显示方案';e={$_.VideoModeDescription}}, #String, bit
@{l='当前位深';e={($_.CurrentBitsPerPixel).ToString()+"bit, 2^"+($_.CurrentBitsPerPixel).ToString()+" 色"}},
@{l='驱动版本';e={$_.DriverVersion}}, #String
@{l='驱动日期';e={([Datetime]::ParseExact((($_.DriverDate).ToString().Substring(0,21)), 'yyyyMMddHHmmss.ffffff',$null).ToString("yyyy-MM-dd"))}} `
| Out-String).Trim() #CustomObject
#$GraphicsCard0 >> D:\Desktop\1.txt; $GraphicsCard1 >> D:\Desktop\1.txt
$GPUCount+=1
}
#生成Win32驱动的时间格式: (Get-Date).ToString("yyyyMMddHHmmss.ffffff-zz").Replace("--","-0").Replace("-+","+0")
#Win32驱动时间格式转换为yyyy-MM-dd, 实际精确到ffffff, 难度极高
if (Test-Path -PathType Leaf "C:\Windows\System32\nvidia-smi.exe") {""; Invoke-Expression "C:\Windows\System32\nvidia-smi.exe"}
"`n`n 显Display`n 示Monitor`n 器`n"
$MONCount=0
Get-CimInstance -Namespace root\wmi -ClassName WmiMonitorID | Select -Property ManufacturerName,UserFriendlyName,SerialNumberID,YearOfManufacture,WeekOfManufacture `
| ForEach-Object {
$monIDserial=try {ForEach-Object {($_.ManufacturerName -ne 0 | ForEach {[char]$_}) -join ""; ($_.UserFriendlyName -ne 0 | ForEach {[char]$_}) -join ""; ($_.SerialNumberID -ne 0 | ForEach {[char]$_}) -join ""} }
catch {"未知序列号/Serial Unknown"}
#根据星期数计算yyyy-MM-dd(生产时间)
#1year ≈ 51.1775 Weeks×7.01452
$DayEnd =[math]::Round(($_.WeekOfManufacture)*7.01452)
$DayStart =$DayEnd-7
$DateStartEst=([datetime]"01/01/$($_.YearOfManufacture)").AddDays($DayStart-1).ToString("yyyy-MM-dd")
$DateEndEst =([datetime]"01/01/$($_.YearOfManufacture)").AddDays($DayEnd-1).ToString("yyyy-MM-dd")
#标题和居中计算
[string]$heading = "Monitor 显示器 "+$MONCount
[int]$eCenter = $tCenter - $heading.Length/2
#EDID厂商名称转译(数据源于github.com/MaxAnderson95,部分数据有误因此进行了修改)
Switch ($monIDserial[0].ToUpper()) {
{ @("AUO","LGD") -ccontains $_ } {$MonitorBrand ="华硕/Asus"}
{ @("HEI","HIT","HIQ")-ccontains $_ } {$MonitorBrand ="现代/Hyundai"}
{ @("HWP","SEC") -ccontains $_ } {$MonitorBrand ="惠普/Hewlett-Packard/HP"}
{ @("LGD","GSM") -ccontains $_ } {$MonitorBrand ="乐金/LG-Phillips"}
{ @("MEI","MS_") -ccontains $_ } {$MonitorBrand ="松下/Panasonic"}
{ @("SAM","SAN") -ccontains $_ } {$MonitorBrand ="三星/Samsung"}
{ @("TOS","TSB") -ccontains $_ } {$MonitorBrand ="东芝/Toshiba"}
{ @("EIZ","ENC","NAN")-ccontains $_ } {$MonitorBrand ="松下/Panasonic"}
{ @("ACR","AAC","CMO")-ccontains $_ } {$MonitorBrand ="三星/Samsung"}
{ @("_YV","FUJ") -ccontains $_ } {$MonitorBrand ="富士通/Fujitsu"}
"FUS" {$MonitorBrand ="富士通-西门子/Fujitsu-Siemens"}; "ICL" {$MonitorBrand ="富士通ICL/Fujitsu ICL"}
"LPL" {$MonitorBrand ="乐金/LG Electronics"}
"AOC" {$MonitorBrand ="冠捷/AOC"}
"AIC" {$MonitorBrand ="伟联/AG Neovo"}
"APP" {$MonitorBrand ="苹果/Apple Computer"}
"AST" {$MonitorBrand ="虹志/AST Research"}
"BNQ" {$MonitorBrand ="明基/BenQ"}
"CPL" {$MonitorBrand ="仁宝/Compal"}
"CPQ" {$MonitorBrand ="康柏/Compaq"}
"CPT" {$MonitorBrand ="华映/Chunghwa Pciture Tubes, Ltd."}
"CTX" {$MonitorBrand ="中强/CTX"}
"CMN" {$MonitorBrand ="群创光电/Innolux"}
"DEC" {$MonitorBrand ="迪吉多/DEC"}
"DEL" {$MonitorBrand ="戴尔/Dell"}
"DPC" {$MonitorBrand ="台达/Delta"}
"DWE" {$MonitorBrand ="大宇/Daewoo"}
"ELS" {$MonitorBrand ="艾尔莎/ELSA"}
"EPI" {$MonitorBrand ="易美逊/Envision"}
"FCM" {$MonitorBrand ="船井/Funai Electric"}
"GWY" {$MonitorBrand ="捷威/Gateway 2000"}
"HSD" {$MonitorBrand ="Hannspree Inc"}
"HSL" {$MonitorBrand ="Hansol"}
"HTC" {$MonitorBrand ="日立/Hitachi/Nissei"}
"IBM" {$MonitorBrand ="IBM"}
"IVM" {$MonitorBrand ="いいや/Iiyama"}
"KDS" {$MonitorBrand ="Korea Data Systems/KDS"}
"LEN" {$MonitorBrand ="联想/Lenovo"}
"MAX" {$MonitorBrand ="威盛(?)/Belinea GmbH - Maxdata/Brunen"}
"MEL" {$MonitorBrand ="三菱电子/Mitsubishi Electronics"}
"NEC" {$MonitorBrand ="日本电气/NEC"}
"NOK" {$MonitorBrand ="诺基亚通讯(旧名)/Nokia Data"}
"NVD" {$MonitorBrand ="英伟达/Nvidia (可能是富士通/Fujitsu?)"}
"OPT" {$MonitorBrand ="奥图码/Optoma"}
"PHL" {$MonitorBrand ="飞利浦/Philips"}
"REL" {$MonitorBrand ="Relisys"}
"SBI" {$MonitorBrand ="智能技术/司马特/Smarttech"}
"SGI" {$MonitorBrand ="硅谷图形/SGI"}
"SNI" {$MonitorBrand ="西门子-利多富/Siemens-Nixdorf"}
"SNY" {$MonitorBrand ="索尼/Sony"}
"SRC" {$MonitorBrand ="华升/Shamrock"}
"SUN" {$MonitorBrand ="太阳电脑/Sun Microsystems"}
"TAT" {$MonitorBrand ="大同/Tatung"}
"VSC" {$MonitorBrand ="优派/ViewSonic"}
"ZCM" {$MonitorBrand ="天顶/Zenith"}
"UNM" {$MonitorBrand ="Unisys Corporation"}
"UNK" {$MonitorBrand ="未知/Unknown"}; Default {$MonitorBrand ="未知/Unknown"}
}
#输出标题和内容
"-"*$eCenter+$heading+"-"*$eCenter
($_ | Format-List -OutVariable "Monitor$MONCount" `
@{l='名称/型号'; e={$monIDserial[1]}}, #String
@{l='厂商'; e=($MonitorBrand+", EDID原文为"+$monIDserial[0])},
@{l='序列号'; e={$monIDserial[2]}}, #String
@{l='生产于'; e={($_.YearOfManufacture).ToString()+"年, 第"+($_.WeekOfManufacture).ToString()+"个星期"}},
@{l='计算生产时间'; e={($DateStartEst).ToString()+" 至 "+($DateEndEst).ToString()}} | Out-String).Trim()
#$Monitor0 >> D:\Desktop\1.txt; $Monitor1 >> D:\Desktop\1.txt
$MONCount+=1
}
"`n 显示器当前的固件版本一般由自带的OSA按键打开菜单-->信息中可见, 固件的更新方法以厂商官网的产品页或说明书为准`n"
"`n`n 物Physical`n 理`n 硬Disk`n 盘`n"
$PhDCount=0
Get-Disk | Select DiskNumber,PartitionStyle,HealthStatus,FirmwareVersion,FriendlyName,SerialNumber,Size,AllocatedSize,Location `
| ForEach-Object {
#标题和居中计算
[string]$heading = "盘"+$_.DiskNumber+": "+$_.FriendlyName
[int]$eCenter = $tCenter - $heading.Length/2
#输出标题和内容
"-"*$eCenter+$heading+"-"*$eCenter
($_ | Format-List -OutVariable "PhysicalDrive$PhDCount" `
@{l='分区表格式'; e={($_.PartitionStyle).Trim()}},#String
@{l='序列号'; e={$_.SerialNumber}}, #String
@{l='固件版本'; e={$_.FirmwareVersion}}, #String
@{l='设定容量'; e={[math]::Round($_.AllocatedSize / 1GB).ToString()+"GB"}},#String
@{l='实际容量'; e={[math]::Round($_.Size / 1GB).ToString()+"GB"}}, #String
@{l='健康状况'; e={$_.HealthStatus}}, #String
@{l='接口位置'; e={$_.Location}} | Out-String).Trim()
#$PhysicalDrive0 >> D:\Desktop\1.txt; $PhysicalDrive1 >> D:\Desktop\1.txt
$PhDCount+=1
}
"`n`n 逻Logical`n 辑`n 磁Disk`n 盘`n"
$LgDCount=0
Get-WMIObject -Class Win32_LogicalDisk | Select FileSystem,DeviceID,Description,Size,FreeSpace,VolumeName `
| ForEach-Object {
#标注空逻辑磁盘(备用, 因为Format-List中的代码还未测试)
if (!$_.Size) {$Capacity = "不可用(N/A)"; $DiskSpace = "不可用(N/A)"}
else {
$Capacity = "{0:n1}GB" -f($_.Size / 1GB)
$DiskSpace ="{0:n1}GB" -f($_.FreeSpace / 1GB)
}
#标题和居中计算
[string]$heading = "$DiskType"+$_.DeviceID+" "+$_.DiskNumber+$_.VolumeName
[int]$eCenter = $tCenter - $heading.Length/2
#输出标题和内容
"-"*$eCenter+$heading+"-"*$eCenter
($_ | Format-List -ShowError -OutVariable "LogicalDisk$PhDCount" `
@{l='磁盘类型'; e={$_.Description}},#String
@{l='文件系统'; e={if (!$_.FileSystem) {"不可用(N/A)"} else {$_.FileSystem}}}, #拦截空文件系统会产生的错误
@{l='逻辑容量'; e={if (!$_.Size) {"不可用(N/A)"} else {"{0:n1}GB" -f($_.Size / 1GB)}}},#String
@{l='剩余容量'; e={if (!$_.Size) {"不可用(N/A)"} else {"{0:n1}GB" -f($_.Size / 1GB)}}} | Out-String).Trim()
#$LogicalDisk0 >> D:\Desktop\1.txt; $LogicalDisk1 >> D:\Desktop\1.txt
$LgDCount+=1
}
"`n`n 音Audio`n 频`n 端Endpoint`n 口`n 于主板/显卡/USB或PCIE声卡Sound Card/音频均衡界面Audio Interface等设备,`r`n 蓝牙A2DP, USB, TOSLink, 3.5mm,4.35mm, HDMI, RCA, XLR, 1/4`" (6.35mm) TS/TRS的数字或模拟信号输入输出端口`n"
Get-PnpDevice -Class AudioEndpoint -Status OK `
| Select -Property FriendlyName,InstanceId `
| Sort-Object -Unique FriendlyName `
| Format-Table -AutoSize -ShowError -OutVariable "ConnectedAudioEndpoints" @{l='插入的音频端口';e='FriendlyName'},@{l='硬件实例ID';e='InstanceId'}
#$ConnectedAudioEndpoints >> D:\Desktop\1.txt
Try {#$ErrorActionPreference = "Stop"
Get-PnpDevice -Class AudioEndpoint -Status Unknown `
| Select -Property FriendlyName,InstanceId `
| Sort-Object -Unique FriendlyName `
| Format-Table -AutoSize -ShowError -OutVariable "VacantAudioEndpoints" @{l='空出的音频端口';e='FriendlyName'},@{l='硬件实例ID';e='InstanceId'}
} Catch [Microsoft.PowerShell.Cmdletization.Cim.CimJobException] {
Write-Verbose "× 无空出/离线的音频端口" -Verbose
}#Finally {$ErrorActionPreference = "Continue"}
#$VacantAudioEndpoints >> D:\Desktop\1.txt
" 打Printing`n 印`n 队Queue`n 列`n"
Get-PnpDevice -Class PrintQueue -Status OK `
| Select -Property FriendlyName,InstanceId `
| Sort-Object -Unique FriendlyName `
| Format-Table -AutoSize -ShowError -OutVariable "ConnectedPrintingQueue" @{l='已连接的打印设备';e='FriendlyName'},@{l='硬件实例ID';e='InstanceId'}
#$ConnectedPrintingQueue >> D:\Desktop\1.txt
Try {#$ErrorActionPreference = "Stop"
Get-PnpDevice -Class PrintQueue -Status Unknown `
| Select -Property FriendlyName,InstanceId `
| Sort-Object -Unique FriendlyName `
| Format-Table -AutoSize -ShowError -OutVariable "VacantPrintingQueue" @{l='未连接的打印设备';e='FriendlyName'},@{l='硬件实例ID';e='InstanceId'}
} Catch [Microsoft.PowerShell.Cmdletization.Cim.CimJobException] {
Write-Verbose "× 没有任何未连接的打印设备" -Verbose
}#Finally {$ErrorActionPreference = "Continue"}
#$VacantPrintingQueue >> D:\Desktop\1.txt
"`n 通Universal`n 用`n 串Serial`n 行`n 总Bus`n 线`n"
Get-PnpDevice -Class USB -FriendlyName *USB* -Status OK `
| Sort-Object -Unique FriendlyName `
| Format-Table -AutoSize -ShowError -OutVariable "ConnectedUSBDevices" @{l='连接的USB设备';e='FriendlyName'},@{l='硬件实例ID';e='InstanceId'}
#$ConnectedUSBDevices >> D:\Desktop\1.txt
Try {#$ErrorActionPreference = "Stop"
(Get-PnpDevice -Class USB -FriendlyName *USB* -Status Unknown `
| Sort-Object -Unique FriendlyName `
| Format-Table -AutoSize -ShowError -OutVariable "VacantUSBDevices" @{l='未连接的USB设备(可能是系统迁徙或旧设备残留)';e='FriendlyName'},@{l='硬件实例ID';e='InstanceId'} `
| Out-String).Trim()
if ($?) {"Get-PnpDevice 检测到未知设备残留,可以使用SPOOCQ - ghostbuster清理`n"} else {"√ Get-PnpDevice 未检测到USB设备残留,无需清理`n"}
} Catch [Microsoft.PowerShell.Cmdletization.Cim.CimJobException] {
Write-Verbose "× 没有任何未连接的USB设备" -Verbose
}#Finally {$ErrorActionPreference = "Continue"}
#$VacantUSBDevices >> D:\Desktop\1.txt
"`n AMD 驱`n Intel 动`n NVIDIA`n Realtek`n MediaTek`n"
Get-WmiObject Win32_PnPSignedDriver `
| Select DeviceName,DriverVersion,DriverDate `
| Where-Object {($_.DriverDate -ne $null) -and $_.DeviceName -cmatch 'AMD' -or $_.DeviceName -cmatch 'Radeon' -or $_.DeviceName -cmatch 'Intel' -or $_.DeviceName -cmatch 'NVIDIA' -or $_.DeviceName -cmatch 'Realtek' -or $_.DeviceName -match 'MediaTek'} `
| Sort-Object -Unique DriverDate `
| Format-Table -AutoSize -ShowError @{l='硬件';e='DeviceName'},@{l='驱动版本';e='DriverVersion';a='Right'},@{l='编译日期';e={(Get-WmiObject -Class Win32_OperatingSystem).ConvertToDateTime($_.DriverDate).ToString('yyyy-MM-dd')};a='Right'}
"`n 计Scheduled`n 划`n 任Tasks`n 务`n 该步骤可能会花费较长时间完成`n 实现开机启动, 触发启动的类Cron/Anacron任务(如设定闹钟提醒等计划), `r`n 清理掉无效或卸载残留的任务以减少系统占用, 开始菜单输入Task Scheduler打开`n"
Get-ScheduledTask -TaskPath "\" `
| Where {$_.State -eq "Ready"} `
| Select TaskName,@{l='Date';e={ if ($_.Date) { ([datetime]::Parse((($_.Date).ToString()))).ToString('yyyy-MM-dd') } else {" "}} } -OutVariable "ScheduledTasks"
#$ScheduledTasks >> D:\Desktop\1.txt
#转换PSCustomObject格式的非标准(没有Z)ISO 8601时间格式为普通时间, 再转换为yyyy-MM-dd
"`n`n 自Startup`n 启`n 动Items`n 项`n"
[string]$SysStartMenu = "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup"
[string]$UsrStartMenu = "$env:USERPROFILE\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup"
$StartupTbl = New-Object System.Data.DataTable
$StrpItmTtl = [System.Data.DataColumn]::new("文件/REG_SZ")
$StrpCmdTtl = [System.Data.DataColumn]::new("路径/命令")
$StrpUsrTtl = [System.Data.DataColumn]::new("对应用户")
$StartupTbl.Columns.Add($StrpItmTtl); $StartupTbl.Columns.Add($StrpCmdTtl); $StartupTbl.Columns.Add($StrpUsrTtl)
if (Test-Path "$SysStartMenu\*") {
$SysStartItem = Get-ChildItem "$SysStartMenu" | Select-Object Name,Directory
ForEach ($_ in $SysStartItem) {
[void]$StartupTbl.Rows.Add($_.Name, $_.Directory, "所有用户/Public")
}
} else {[void]$StartupTbl.Rows.Add("无项目(N/A)", "无项目(N/A)", "无项目(N/A)")}
if (Test-Path "$UsrStartMenu\*") {
$UsrStartItem = Get-ChildItem "$UsrStartMenu" | Select-Object Name,Directory
ForEach ($_ in $UsrStartItem) {
[void]$StartupTbl.Rows.Add($_.Name, $_.Directory, $env:USERDOMAIN+"\"+$env:USERNAME)
}
} else {[void]$StartupTbl.Rows.Add("无项目(N/A)", "无项目(N/A)", "无项目(N/A)")}
if (Get-WmiObject Win32_StartupCommand) {
$RegStartItem = Get-WmiObject Win32_StartupCommand `
| Where-Object {$_.Location -notlike "*Startup*"} `
| Select Location,Command,User `
| Sort-Object Command -Unique
ForEach ($_ in $RegStartItem) {
[void]$StartupTbl.Rows.Add($_.Location, $_.Command, $_.User)
}
} else {[void]$StartupTbl.Rows.Add("无项目(N/A)", "无项目(N/A)", "无项目(N/A)")}
($StartupTbl | Out-String).Trim()
"`r`n ... 剩余的自启动项见任务管理器Ctrl+Shift+Esc的`"启动`"菜单`n"
"`n 蓝Blue`n 牙`n 协Tooth`n 议`n " #蓝牙版本的LMP-->BT转码参考自: reddit.com/r/PowerShell/comments/vmexhm
$AllBTDcs = Get-PnpDevice -Class "Bluetooth" -PresentOnly | Where-Object {$_.FriendlyName -notmatch "Microsoft"}
$BTDvcTbl = New-Object System.Data.DataTable
$BTVersn = [System.Data.DataColumn]::new("BT")
$NameTtl = [System.Data.DataColumn]::new("设备名称")
$DvrVrsn = [System.Data.DataColumn]::new("驱动版本")
$InstcID = [System.Data.DataColumn]::new("硬件实例ID")
$BTDvcTbl.Columns.Add($BTVersn); $BTDvcTbl.Columns.Add($DvrVrsn); $BTDvcTbl.Columns.Add($NameTtl); $BTDvcTbl.Columns.Add($InstcID)
Foreach ($_ in $AllBTDcs) {
$BTDevLMP = (Get-PnpDeviceProperty -KeyName "DEVPKEY_Bluetooth_RadioLmpVersion" -InstanceId $_.InstanceID).Data #获取LMP和驱动版本两个设备属性
$BTDvrVrn = (Get-PnpDeviceProperty -KeyName "DEVPKEY_Device_DriverVersion" -InstanceId $_.InstanceID).Data
if ($BTDevLMP) {#通过设备属性计算蓝牙版本,一次一个
$BTVersion = Switch ($BTDevLMP) {
0 {'1.0b'} 1 {'1.1'} 2 {'1.2'} 3 {'2.0+EDR'} 4 {'2.1+EDR'} 5 {'3.0+HS'} 6 {'4.0'} 7 {'4.1'} 8 {'4.2'} 9 {'5.0'} 10 {'5.1'} 11 {'5.2'}
default {"× 错误"}
}
} else {$BTVersion=" "}#"... 未连接的蓝牙软硬件: "+$_.InstanceID
[void]$BTDvcTbl.Rows.Add($BTVersion, $BTDvrVrn, $_.FriendlyName, $_.InstanceId)
}
($BTDvcTbl | Sort-Object -Property "BT" -Descending | Format-Table -ShowError -AutoSize -OutVariable "BlueToothDevices" | Out-String).Trim()
#$BlueToothDevices >> D:\Desktop\1.txt
"`r`n 硬件支持的蓝牙协议版本与蓝牙音频A2DP编解码格式的支持无关,`r`n Hardware-side supported Bluetooth & A2DP audio version doesn't guarantee a software support"
" 可使用Wireshark的`"btavdtp.signel_id`"过滤以显示16进制的A2SP音频编号, 对照查询`r`n Software-side support can be found in Wireshark's `"btavdtp.signel_id`" filter, which is the hexadecimal A2DP audio codec used"
"`n`n 电Battery`n 池`n 与&`n 不Uninterruptible`n 间`n 断`n 电Powersupply`n 源"
"`r`n 详细的系统用电报告, 电池寿命报告可见于 / The detailed powerdraw & batterylife report can be found via this commandline:`r`n `"powercfg /BATTERYREPORT && powercfg /SYSTEMPOWERREPORT`""
$BTTCount=0
if (Get-CimInstance -ClassName Win32_Battery) {
Get-CimInstance -ClassName Win32_Battery | Select Name,Availability,PowerManagementSupported,Chemistry,DesignCapacity,DesignVoltage,EstimatedChargeRemaining,EstimatedRunTime `
| ForEach-Object {
Switch ($_.Availability) {
1 {[string]$btState = "放电中"}
2 {[string]$btState = "未知"}
3 {[string]$btState = "电量高"}
4 {[string]$btState = "电量低"}
5 {[string]$btState = "电量极低"}
6 {[string]$btState = "正在充电"}
7 {[string]$btState = "正在充电, 电量高"}
8 {[string]$btState = "正在充电, 电量低"}
9 {[string]$btState = "正在充电, 电量极低"}
11{[string]$btState = "未充满"}
Default{$btState = ($_.Availability).ToString()}
}
Switch ($_.Chemistry) {
1 {[string]$btChems = "其它"}
2 {[string]$btChems = "未知"}
3 {[string]$btChems = "二氧化铅硫酸/铅酸/Lead-Acid"}
4 {[string]$btChems = "镉镍/Nickel-cadmium"}
5 {[string]$btChems = "长期储电镍氢/Nickel-Metal-Hydride"}
6 {[string]$btChems = "锂离子/Lithium-ion"}
7 {[string]$btChems = "锌空气/锌氧/Zinc-Air Fuel"}
8 {[string]$btChems = "锂聚合物/Lithium Polymer"}
Default{$btChems = ($_.Availability).ToString()}
}
#标题和居中计算
[string]$heading = ($_.Name).Trim()
[int]$eCenter = $tCenter - $heading.Length/2
#输出标题和内容
"-"*$eCenter+$heading+"-"*$eCenter
($_ | Format-List -ShowError -OutVariable "BatteryUPS$BTTCount" `
@{l='设计电量'; e={if ($_.DesignCapacity -eq $null) {"不可用(N/A)"} else {($_.DesignCapacity).ToString()+"mAh"}}},#String
@{l='设计电压'; e={if ($_.DesignVoltage -eq $null) {"不可用(N/A)"} else {($_.DesignVoltage / 1000).ToString()+"V"}}},#String
@{l='预估电量'; e={($_.EstimatedChargeRemaining).ToString()+"%"}},#String
@{l='预估可用'; e={($_.EstimatedRunTime).ToString()+"分钟"}},#String
@{l='状态'; e={$btState}}, #String
@{l='系统电源管理';e={$_.PowerManagementSupported}},#String
@{l='电芯化合物'; e={$btChems}} `
| Out-String).Trim()
#$BatteryUPS0 >> D:\Desktop\1.txt; $BatteryUPS >> D:\Desktop\1.txt
$BTTCount+=1
}
} else {"`n× 电池与UPS总数为0`n"}
"`n 隐 Hidden`n 藏`n 电 Power`n 源`n 与 &`n CPU`n 调 Scheduling`n 度`n 选 Options`n 项"
Get-ChildItem 'HKLM:\SYSTEM\CurrentControlSet\Control\Power\PowerSettings' -Recurse | `
Where-Object Property -contain 'Attributes' | Get-ItemProperty | Where-Object Attributes -eq 2 | `
Select @{l='名称';e={$_.FriendlyName.Split(',')[-1]}},@{l='简介';e={$_.Description.Split(',')[-1]}},@{l='Min';e='ValueMin'},@{l='Max';e='ValueMax'},@{l='单位';e={$_.ValueUnits.Split(',')[-1]}},@{l='GUID';e='PSCHildName'} | `
Format-Table -AutoSize
" 系System`n 统`n 插Slots`n 槽"
$ConnectorType = @{
l='类型'
e={ # property is an array, so process all values
foreach($ctype in $_.ConnectorType) { Switch([int]$ctype) {
100 {'PCI-E'} 0 {'未标记/未知'} 1 {'其它'} 2 {'Male'} 3 {'Female'}
4 {'Shielded'} 5 {'Unshielded'}
6 {'SCSI (A) High-Density (50 pins)'} 7 {'SCSI (A) Low-Density (50 pins)'} 8 {'SCSI (P) High-Density (68 pins)'}
9 {'SCSI SCA-I (80 pins)'} 10 {'SCSI SCA-II (80pins)'} 11 {'SCSI Fibre Ch. (DB-9, Copper)'}12 {'SCSI Fibre Ch. (Fibre)'}13 {'SCSI Fibre Ch. SCA-II (40pins)'} 14 {'SCSI Fibre Ch. SCA-II (20pins)'} 15 {'SCSI Fibre Ch. BNC'}
16 {'ATA 3-1/2 Inch (40 pins)'} 17 {'ATA 2-1/2 Inch (44 pins)'}
18 {'ATA-2'} 19 {'ATA-3'} 20 {'ATA/66'}
21 {'DB-9'} 22 {'DB-15'} 23 {'DB-25'} 24 {'DB-36'}
25 {'RS-232C'} 26 {'RS-422'} 27 {'RS-423'} 28 {'RS-485'} 29 {'RS-449'}
30 {'V.35'} 31 {'X.21'} 32 {'IEEE-488'} 33 {'AUI'}
34 {'UTP Cat.3'} 35 {'UTP Cat.4'} 36 {'UTP Cat.5'}
37 {'BNC'} 38 {'RJ11'} 39 {'RJ45'}
40 {'Fiber MIC'} 41 {'Apple AUI'} 42 {'Apple GeoPort'}
43 {'PCI'} 44 {'ISA'} 45 {'EISA'} 46 {'VESA'}
47 {'PCMCIA'} 48 {'PCMCIA Type I'} 49 {'PCMCIA Type II'} 50 {'PCMCIA Type III'}
51 {'ZV Port'} 52 {'CardBus'} 53 {'USB'} 54 {'IEEE 1394'}
55 {'HIPPI'} 56 {'HSSDC (6 pins)'} 57 {'GBIC'}
58 {'DIN'} 59 {'Mini-DIN'} 60 {'Micro-DIN'} 61 {'PS/2'}
62 {'Infrared'} 63 {'HP-HIL'}
64 {'Access.bus'} 65 {'NuBus'}
66 {'Centronics'} 67 {'Mini-Centronics'} 68 {'Mini-Centronics Type14'} 69 {'Mini-Centronics Type20'} 70 {'Mini-Centronics Type26'}
71 {'Bus Mouse'} 72 {'ADB'} 73 {'AGP'} 74 {'VME Bus'} 75 {'VME64'}
76 {'Proprietary'}77 {'Proprietary CPU Card Slot'} 78 {'Proprietary Memory Card Slot'} 79 {'Proprietary I/O Riser Slot'}
80 {'PCI-66MHZ'} 81 {'AGP2X'} 82 {'AGP4X'}
83 {'PC-98'} 84 {'PC-98-Hireso'} 85 {'PC-H98'} 86 {'PC-98Note'} 87 {'PC-98Full'} 88 {'PCI-X'}
89 {'Sbus IEEE 1396-1993 32 bit'} 90 {'Sbus IEEE 1396-1993 64 bit'}
91 {'MCA'} 92 {'GIO'} 93 {'XIO'} 94 {'HIO'} 95 {'NGIO'} 96 {'PMC'} 97 {'Future I/O'} 98 {'InfiniBand'}
99 {'AGP8X'} $null {'BIOS未报告'} Default {$ctype.ToString()}
}}}
}
$CurrentUsage = @{
l='使用状态'
e={ $value = $_.CurrentUsage
switch([int]$value) {
0 {'保留/Reserved'} 1 {'其它/Other'}
2 {'未知/Unknown'} 3 {'正常/Normal'}
4 {'使用中/In use'} $null {'BIOS未报告'}
Default {"$value"}
}
}
}
#$MaxDataWidth = @{
# l='数据总线位宽(返回值不符合微软定义)'
# e={ ([Math]::Pow(2, $_.MaxDataWidth+3)).ToString()+"bit" }
#}
Get-CimInstance -ClassName Win32_SystemSlot `
| Select-Object -Property @{l='指定类'; e={$_.SlotDesignation}},@{l='状况';e='Status'}, $ConnectorType, @{l='支持休眠唤醒'; e={$_.PMESignal}}, @{l='可热插拔'; e={$_.SupportsHotPlug}}, $CurrentUsage `
| Format-Table -AutoSize -OutVariable $SystemSlots
" 总`n 线Bus`n 分`n 布Distribution"
Get-WMIObject Win32_DeviceBus | `
Sort-Object Antecedent,Dependent | `
Select @{l='Bus'; e={($_.Antecedent.Split("`"").Split("_") | Select -Index 4)}},
@{l='上游'; e={($_.Antecedent.Split("`"").Split("_") | Select-Object -Index 2)}},
@{l='下游'; e={($_.Dependent.Split("`"") | Select -Index 1).Split("\\") | Select -Index 0}},
@{l='设备'; e={($_.Dependent.Split("`"") | Select -Index 1).Split("\\") | Select -Index 2}} | `
Format-Table -AutoSize -OutVariable $BusDistribution
" AMD 软`n Intel 件`n NVIDIA`n Realtek`n MediaTek`n 该步骤可能会花费较长时间完成,超过30秒则按Enter`n"
Get-WmiObject -Class Win32_Product `
| Where-Object {$_.Vendor -notmatch "Microsoft"} `
| Select Name,Version `
| Where-Object {$_.Name -cmatch 'AMD' -or $_.Name -cmatch 'Intel' -or $_.Name -cmatch 'NVIDIA' -or $_.DeviceName -cmatch 'Realtek' -or $_.DeviceName -match 'MediaTek'} `
| Sort-Object -Unique Version `
| Format-Table -Autosize -ShowError @{l='软件';e='Name'},@{l='版本';e='Version';a='Right'}
Read-Host " 已完成. 用鼠标拖选,右键单击复制, 或在活动窗口上输入以下内容以导出需要的部分:
`$ScheduledTasks >> D:\1.txt
`$VacantUSBDevices >> D:\1.txt
`$ConnectedUSBDevices >> D:\1.txt
`$VacantPrintingQueue >> D:\1.txt
`$ConnectedPrintingQueue >> D:\1.txt
`$VacantAudioEndpoints >> D:\1.txt
`$ConnectedAudioEndpoints >> D:\1.txt
`$Motherboard >> D:\1.txt
`$BlueToothDevices >> D:\1.txt
`$LogicalDisk0 >> D:\1.txt; `$LogicalDisk1 >> D:\1.txt
`$PhysicalDrive0 >> D:\1.txt; `$PhysicalDrive1 >> D:\1.txt
`$Monitor0 >> D:\1.txt; `$Monitor1 >> D:\1.txt
`$GraphicsCard0 >> D:\1.txt; `$GraphicsCard1 >> D:\1.txt
`$Memory0 >> D:\1.txt; `$Memory2 >> D:\1.txt
`$Processor0 >> D:\1.txt; `$Processor1 >> D:\1.txt
`$BatteryUPS0 >> D:\1.txt; `$BatteryUPS1 >> D:\1.txt
`$BusDistribution >> D:\1.txt
`$SystemSlots >> D:\1.txt
"
符合PowerShell函数模块格式标准(大概)的写法也不能少。分为后缀.psm1
的模块及.psd1
的清单文件,默认放于$HOME\Documents\PowerShell\Modules
下;用时打开PowerShell输入Import-Module xx.psm1
,然后调用里面的函数就能跑了。
这个函数改版将运行系统跑分的选项从Read-host改成了输入参数,默认否,也是做参考用的
Function Get-myPC {
<#
.Synopsis
列出本电脑系统及所有硬件的信息。
.Description
使用Get-myPC函数获取计算机名,Windows版本,Windows体验指数跑分,以及主板,处理器,内存条,BIOS,显卡,物理磁盘和逻辑磁盘的详细信息。
Get-myPC函数不需要参数,直接输入即运行。输入-Runbenchmark y以运行跑分,参数值默认为n,代表跳过。
举例,输入Get-myPC函数并回车,该函数随即自动列出本电脑系统及所有硬件的信息。
举例,输入Get-myPC -Runbenchmark y并回车,该函数随即运行Windows体验指数性能跑分,并列出本电脑系统及所有硬件的信息。
.Example
Get-myPC
检测日期: 星期五, 四月 01, 2022
计算机名: R5-2600,
Microsoft Windows 10 企业版 LTSC
跑分跳过!
系Windows
统
体Experience
验
跑Index
分(筛选最差)
----------------总分: 8.9----------------
处理器得分: 9.5
2D图形得分: 9.9
3D图形得分: 9.9
硬盘得分: 8.9
主Mother
板board
名称: X470 AORUS ULTRA GAMING-CF
厂商: Gigabyte Technology Co., Ltd.
状况: OK
型号:
序列号: Default string
版本: Default string
---后来输出内容省略---
.Example
Get-myPC -Runbenchmark y
检测日期: 星期五, 四月 01, 2022
计算机名: R5-2600,
Microsoft Windows 10 企业版 LTSC
系Windows
统
体Experience
验
跑Index
分(筛选最差)
----------------总分: 8.9----------------
处理器得分: 9.5
2D图形得分: 9.9
3D图形得分: 9.9
硬盘得分: 8.9
主Mother
板board
名称: X470 AORUS ULTRA GAMING-CF
厂商: Gigabyte Technology Co., Ltd.
状况: OK
型号:
序列号: Default string
版本: Default string
---后来输出内容省略---
#>
clear
"建议全屏运行. Running under maxized window is preferred.`r`n含独立显卡的笔记本电脑会于低能耗模式下断其电源, 需切换核显到独显才能检测到独显.`r`nLaptop w/ may cut power to discrete GPU for power-saving, detection may requires switching from iGPU to GPU"
"`r`n以 `"Powershell -noexit "+($pwd.Path)+"\Get-MyPC.ps1`" 运行本脚本以保留交互窗口可用`r`nRun with `"Powershell -noexit "+($pwd.Path)+"\Get-MyPC.ps1`" if user prompts upon script completion is preferred."
$ErrorActionPreference = "Stop"
"`r`n检测日期: {0:dddd, MMMM dd, yyyy, UTCzzz}" -f (Get-Date) + "`r`n计算机名: "+$env:computername+", "+(Get-WmiObject -class Win32_OperatingSystem).Caption
if (($host.name -match 'consolehost')) { #PowerShell窗口
$oWidth = gwmi win32_videocontroller | select-object CurrentHorizontalResolution -first 1
$oHeight = gwmi win32_videocontroller | select-object CurrentVerticalResolution -first 1
"主显示器宽: "+(([Convert]::ToInt32($oWidth.CurrentHorizontalResolution)))
"主显示器高: "+(([Convert]::ToInt32($oHeight.CurrentVerticalResolution)))
"`r`n√ 运行于PowerShell Console窗口中"
}
else { #PowerShell ISE窗口
"主显示器宽: "+([System.Windows.Forms.SystemInformation]::PrimaryMonitorSize.Width)
"主显示器高: "+([System.Windows.Forms.SystemInformation]::PrimaryMonitorSize.Height)
"`r`n√ 运行于PowerShell ISE窗口中"
}
switch (Read-Host " `n运行系统跑分吗(耗时~5分钟,输入y或n后按Enter)") {
'y' {WinSat formal}
'n' {"跑分跳过!"}
default {"未输入条件!"}
}
#设定标题长28
[int]$tCenter = 28
"`n`n 系Windows`n 统`n 体Experience`n 验`n 跑Index`n 分(筛选最差)`n"
$ExpIdx = Get-CimInstance Win32_WinSat | Select CPUScore,D3DScore,DiskScore,GraphicsScore,WinSATAssessmentState,WinSPRLevel
#标题和居中计算
[string]$heading = "总分: "+$ExpIdx.WinSPRLevel
[int]$eCenter = $tCenter - $heading.Length/2
#输出标题和内容
"-"*$eCenter+$heading+"-"*$eCenter
($ExpIdx | Format-List @{l='处理器得分';e='CPUScore'},@{l='2D图形得分';e='GraphicsScore'},@{l='3D图形得分';e='D3DScore'},@{l='硬盘得分';e='DiskScore'} `
| Out-String).Trim()
"`n`n 主Mother`n 板board`n"
$MB = Get-WmiObject Win32_Baseboard | Select Product,Status,Manufacturer,Model,SerialNumber,Version
#标题和居中计算
[string]$heading = $MB.Product
[int]$eCenter = $tCenter - $heading.Length/2
#输出标题和内容
"-"*$eCenter+$heading+"-"*$eCenter
($MB | Format-List -OutVariable "Motherboard" @{l='状况';e='Status'},@{l='厂商';e='Manufacturer'},@{l='型号';e='Model'},@{l='序列号';e='SerialNumber'},@{l='REV版本';e='Version'} `
| Out-String).Trim()
#$Motherboard >> D:\Desktop\1.txt
"`n`n 中C`n 央P`n 处U`n 理`n 器`n"
$CPUCount=0
Get-CimInstance Win32_Processor | Select Availability,CurrentClockSpeed,MaxClockSpeed,Name,DeviceID,NumberOfCores,ThreadCount,LoadPercentage,VoltageCaps,VirtualizationFirmwareEnabled,L2CacheSize,L3CacheSize `
| ForEach-Object {#为多路处理器系统准备的循环
Switch ($_.Availability) {#区分设备运行与供电状态
2 {[string]$prState = "未知"}
3 {[string]$prState = "正常"}
8{[string]$prState = "脱机"}
4 {[string]$prState = "报警中"}
5 {[string]$prState = "处于测试状态"}
18{[string]$prState = "暂停中"}
11{[string]$prState = "未安装"}
12{[string]$prState = "安装错误"}
16{[string]$prState = "重新启动中"}
17{[string]$prState = "省电模式: 警告"}
13{[string]$prState = "省电模式: 未知"}
14{[string]$prState = "省电模式: 节能"}
15{[string]$prState = "省电模式: 待机"}
20{[string]$prState = "处理器缺少状态参数"}
21{[string]$prState = "反馈被阻止"}
Default{$prState = ($_.Availability).ToString()}
}
#标题和居中计算
[string]$heading = $_.DeviceID+": "+($_.Name).Trim()
[int]$eCenter = $tCenter - $heading.Length/2
#输出标题和内容
"-"*$eCenter+$heading+"-"*$eCenter
#即使是在pipe里的循环中也仍需为Format-List重新pipe一次
($_ | Format-List -ShowError -OutVariable "Processor$CPUCount" `
@{l='当前频率'; e=($_.CurrentClockSpeed).ToString()},
@{l='最大频率'; e=($_.MaxClockSpeed).ToString()},
@{l='状态'; e=$prState},
@{l='L2缓存'; e={($_.L2CacheSize*1KB / 1MB).ToString()+"MB"}},#原始数据为1KB, 而直接除以MB会按1B/1MB算
@{l='L3缓存'; e={($_.L3CacheSize*1KB / 1MB).ToString()+"MB"}},#所以先乘以1KB, 使其转换为1024B倍实现单位对齐, 再除以1MB
@{l='最大工作电压';e={($_.VoltageCaps / 1000).ToString()+"V"}},
@{l='当前负载'; e={($_.LoadPercentage).ToString()+"%" }},
@{l='虚拟化已开'; e={($_.VirtualizationFirmwareEnabled).ToString()}} `
| Out-String).Trim()
#$Processor0 >> D:\Desktop\1.txt; $Processor1 >> D:\Desktop\1.txt
$CPUCount+=1
}
"`n`n 内R`n 存A`n 条M`n"
$RAMCount=$GBpsCount=0
Get-WmiObject -Class Win32_PhysicalMemory | Select SMBIOSMemoryType,Manufacturer,ConfiguredVoltage,ConfiguredClockSpeed,BankLabel,MaxVoltage,PartNumber,Tag,Capacity,TotalWidth `
| ForEach-Object {#逐内存条显示信息的循环
Switch ($_.SMBIOSMemoryType) {
20{[string]$memType = "DDR"}
21{[string]$memType = "DDR2"}
22{[string]$memType = "DDR2 FB-DIMM"}
24{[string]$memType = "DDR3"}
26{[string]$memType = "DDR4"}
34{[string]$memType = "DDR5"}
0 {[string]$memType = "不可用(N/A)"}
1 {[string]$memType = "其它"}
2 {[string]$memType = "DRAM"}
{$_ -eq 3 -or $_ -eq 17} {[string]$memType = "同步内存/Synchronous DRAM/SDRAM"}
4 {[string]$memType = "其它缓存嵌入式内存/Cached DRAM"}
6 {[string]$memType = "处理器嵌入内存/Embedded DRAM/eDRAM"}
7 {[string]$memType = "图形内存/VRAM"}
8 {[string]$memType = "静态内存/非刷新内存/Static RAM/SRAM"}
{$_ -eq 9 -or $_ -eq 10} {[string]$memType = "只读存储/ROM"}
11{[string]$memType = "闪存/Flash"}
12{[string]$memType = "通电可编程只读存储/EEPROM"}
13{[string]$memType = "可编程只读闪存/FEPROM"}
14{[string]$memType = "可编程只读存储/EPROM"}
15{[string]$memType = "SRAM缓存嵌入式内存/CDRAM"}
16{[string]$memType = "3DRAM"}
18{[string]$memType = "同步接口图形内存/SGRAM"}
19{[string]$memType = "Rambus DRAM/RDRAM/RIMM"}
Default{$memType = ($_.SMBIOSMemoryType).ToString()}
}
#标题和居中计算
[string]$heading = $_.Tag+": "+($_.PartNumber).Trim()
[int]$eCenter = $tCenter - $heading.Length/2
#输出标题和内容
"-"*$eCenter+$heading+"-"*$eCenter
($_ | Format-List -OutVariable "Memory$RAMCount" `
@{l='频率'; e={($_.ConfiguredClockSpeed).ToString()+"MT/s (Mbps)"}},
@{l='厂商'; e='Manufacturer'},
@{l='容量'; e={($_.Capacity / 1GB).ToString()+"GB"}},
@{l='内存介质'; e={$memType}},
@{l='数据总线位宽';e={($_.TotalWidth).ToString()+"bit" }},
@{l='最大工作电压';e={($_.MaxVoltage / 1000).ToString()+"V"}},
@{l='当前工作电压';e={($_.ConfiguredVoltage / 1000).ToString()+"V"}},
@{l='理论最高带宽';e={($_.ConfiguredClockSpeed * $_.TotalWidth/8 / 1000).ToString()+"GB/s"}},
@{l='物理库(RANK)';e='BankLabel'} `
| Out-String).Trim()
#$Memory0 >> D:\Desktop\1.txt; $Memory2 >> D:\Desktop\1.txt
$GBpsCount+=$_.ConfiguredClockSpeed * $_.TotalWidth/8 / 1000
$RAMCount +=1
}
"`n 累积理论最高带宽:$GBpsCount GB/s 或 "+($GBpsCount*8)+" Gbps `n"
"`n`n B`n I`n O`n S`n"
$MBBIOS = Get-CimInstance Win32_BIOS | Select Status,Name,BIOSVersion,SMBIOSBIOSVersion,ReleaseDate
#标题和居中计算
[string]$heading = ($MBBIOS.BIOSVersion).Trim()
[int]$eCenter = $tCenter - $heading.Length/2
#输出标题和内容
"-"*$eCenter+$heading+"-"*$eCenter
($MBBIOS | Format-List -ShowError -OutVariable "BIOS" @{l='名称/版本';e='Name'},@{l='状况';e='Status'},@{l='发行日期';e={($_.ReleaseDate).ToString('yyyy-MM-d')}},@{l='系统用BIOS版本';e='SMBIOSBIOSVersion'} `
| Out-String).Trim()
#$BIOS >> D:\Desktop\1.txt
"注:MSI微星BIOS版号写作如7C91vA9的数字;其中vA9代表Version A.90或其它数字"
"`n`n 图G`n 形P`n 处U`n 理`n 器`n"
$GPUCount=0
Get-WMIObject -Class Win32_VideoController | Select DeviceID,Availability,Name,DriverVersion,DriverDate,VideoModeDescription,CurrentBitsPerPixel `
| ForEach-Object {#为多显卡系统准备的循环, 包括核显
if ($_.CurrentBitsPerPixel -eq $null) {$_.CurrentBitsPerPixel = 0} #ForEach-Object : 不能对 Null 值表达式调用方法
#区分设备运行与供电状态
Switch ($_.Availability) {
2 {[string]$prState = "未知"}
3 {[string]$prState = "正常"}
8 {[string]$prState = "脱机"}
4 {[string]$prState = "报警中"}
5 {[string]$prState = "处于测试状态"}
18{[string]$prState = "暂停中"}
11{[string]$prState = "未安装"}
12{[string]$prState = "安装错误"}
16{[string]$prState = "重新启动中"}
17{[string]$prState = "省电模式: 警告"}
13{[string]$prState = "省电模式: 未知"}
14{[string]$prState = "省电模式: 节能"}
15{[string]$prState = "省电模式: 待机"}
20{[string]$prState = "处理器缺少状态参数"}
21{[string]$prState = "反馈被阻止"}
Default{$prState = ($_.Availability).ToString()}
}
#标题和居中计算
[string]$heading = $_.DeviceID+": "+$_.Name
[int]$eCenter = $tCenter - $heading.Length/2
#输出标题和内容
"-"*$eCenter+$heading+"-"*$eCenter
#即使是在pipe里的循环中也仍需为Format-List重新pipe一次
($_ | Format-List -ShowError -OutVariable "GraphicsCard$GPUCount" `
@{l='状态'; e={$prState}}, #String
@{l='显示方案';e={$_.VideoModeDescription}}, #String, bit
@{l='当前位深';e={($_.CurrentBitsPerPixel).ToString()+"bit, 2^"+($_.CurrentBitsPerPixel).ToString()+" 色"}},
@{l='驱动版本';e={$_.DriverVersion}}, #String
@{l='驱动日期';e={([Datetime]::ParseExact((($_.DriverDate).ToString().Substring(0,21)), 'yyyyMMddHHmmss.ffffff',$null).ToString("yyyy-MM-dd"))}} `
| Out-String).Trim() #CustomObject
#$GraphicsCard0 >> D:\Desktop\1.txt; $GraphicsCard1 >> D:\Desktop\1.txt
$GPUCount+=1
}
#生成Win32驱动的时间格式: (Get-Date).ToString("yyyyMMddHHmmss.ffffff-zz").Replace("--","-0").Replace("-+","+0")
#Win32驱动时间格式转换为yyyy-MM-dd, 实际精确到ffffff, 难度极高
if (Test-Path -PathType Leaf "C:\Windows\System32\nvidia-smi.exe") {""; Invoke-Expression "C:\Windows\System32\nvidia-smi.exe"}
"`n`n 显Display`n 示Monitor`n 器`n"
$MONCount=0
Get-CimInstance -Namespace root\wmi -ClassName WmiMonitorID | Select -Property ManufacturerName,UserFriendlyName,SerialNumberID,YearOfManufacture,WeekOfManufacture `
| ForEach-Object {
$monIDserial=try {ForEach-Object {($_.ManufacturerName -ne 0 | ForEach {[char]$_}) -join ""; ($_.UserFriendlyName -ne 0 | ForEach {[char]$_}) -join ""; ($_.SerialNumberID -ne 0 | ForEach {[char]$_}) -join ""} }
catch {"未知序列号/Serial Unknown"}
#根据星期数计算yyyy-MM-dd(生产时间)
#1year ≈ 51.1775 Weeks×7.01452
$DayEnd =[math]::Round(($_.WeekOfManufacture)*7.01452)
$DayStart =$DayEnd-7
$DateStartEst=([datetime]"01/01/$($_.YearOfManufacture)").AddDays($DayStart-1).ToString("yyyy-MM-dd")
$DateEndEst =([datetime]"01/01/$($_.YearOfManufacture)").AddDays($DayEnd-1).ToString("yyyy-MM-dd")
#标题和居中计算
[string]$heading = "Monitor 显示器 "+$MONCount
[int]$eCenter = $tCenter - $heading.Length/2
#EDID厂商名称转译(数据源于github.com/MaxAnderson95,部分数据有误因此进行了修改)
Switch ($monIDserial[0].ToUpper()) {
{ @("AUO","LGD") -ccontains $_ } {$MonitorBrand ="华硕/Asus"}
{ @("HEI","HIT","HIQ")-ccontains $_ } {$MonitorBrand ="现代/Hyundai"}
{ @("HWP","SEC") -ccontains $_ } {$MonitorBrand ="惠普/Hewlett-Packard/HP"}
{ @("LGD","GSM") -ccontains $_ } {$MonitorBrand ="乐金/LG-Phillips"}
{ @("MEI","MS_") -ccontains $_ } {$MonitorBrand ="松下/Panasonic"}
{ @("SAM","SAN") -ccontains $_ } {$MonitorBrand ="三星/Samsung"}
{ @("TOS","TSB") -ccontains $_ } {$MonitorBrand ="东芝/Toshiba"}
{ @("EIZ","ENC","NAN")-ccontains $_ } {$MonitorBrand ="松下/Panasonic"}
{ @("ACR","AAC","CMO")-ccontains $_ } {$MonitorBrand ="三星/Samsung"}
{ @("_YV","FUJ") -ccontains $_ } {$MonitorBrand ="富士通/Fujitsu"}
"FUS" {$MonitorBrand ="富士通-西门子/Fujitsu-Siemens"}; "ICL" {$MonitorBrand ="富士通ICL/Fujitsu ICL"}
"LPL" {$MonitorBrand ="乐金/LG Electronics"}
"AOC" {$MonitorBrand ="冠捷/AOC"}
"AIC" {$MonitorBrand ="伟联/AG Neovo"}
"APP" {$MonitorBrand ="苹果/Apple Computer"}
"AST" {$MonitorBrand ="虹志/AST Research"}
"BNQ" {$MonitorBrand ="明基/BenQ"}
"CPL" {$MonitorBrand ="仁宝/Compal"}
"CPQ" {$MonitorBrand ="康柏/Compaq"}
"CPT" {$MonitorBrand ="华映/Chunghwa Pciture Tubes, Ltd."}
"CTX" {$MonitorBrand ="中强/CTX"}
"CMN" {$MonitorBrand ="群创光电/Innolux"}
"DEC" {$MonitorBrand ="迪吉多/DEC"}
"DEL" {$MonitorBrand ="戴尔/Dell"}
"DPC" {$MonitorBrand ="台达/Delta"}
"DWE" {$MonitorBrand ="大宇/Daewoo"}
"ELS" {$MonitorBrand ="艾尔莎/ELSA"}
"EPI" {$MonitorBrand ="易美逊/Envision"}
"FCM" {$MonitorBrand ="船井/Funai Electric"}
"GWY" {$MonitorBrand ="捷威/Gateway 2000"}
"HSD" {$MonitorBrand ="Hannspree Inc"}
"HSL" {$MonitorBrand ="Hansol"}
"HTC" {$MonitorBrand ="日立/Hitachi/Nissei"}
"IBM" {$MonitorBrand ="IBM"}
"IVM" {$MonitorBrand ="いいや/Iiyama"}
"KDS" {$MonitorBrand ="Korea Data Systems/KDS"}
"LEN" {$MonitorBrand ="联想/Lenovo"}
"MAX" {$MonitorBrand ="威盛(?)/Belinea GmbH - Maxdata/Brunen"}
"MEL" {$MonitorBrand ="三菱电子/Mitsubishi Electronics"}
"NEC" {$MonitorBrand ="日本电气/NEC"}
"NOK" {$MonitorBrand ="诺基亚通讯(旧名)/Nokia Data"}
"NVD" {$MonitorBrand ="英伟达/Nvidia (可能是富士通/Fujitsu?)"}
"OPT" {$MonitorBrand ="奥图码/Optoma"}
"PHL" {$MonitorBrand ="飞利浦/Philips"}
"REL" {$MonitorBrand ="Relisys"}
"SBI" {$MonitorBrand ="智能技术/司马特/Smarttech"}
"SGI" {$MonitorBrand ="硅谷图形/SGI"}
"SNI" {$MonitorBrand ="西门子-利多富/Siemens-Nixdorf"}
"SNY" {$MonitorBrand ="索尼/Sony"}
"SRC" {$MonitorBrand ="华升/Shamrock"}
"SUN" {$MonitorBrand ="太阳电脑/Sun Microsystems"}
"TAT" {$MonitorBrand ="大同/Tatung"}
"VSC" {$MonitorBrand ="优派/ViewSonic"}
"ZCM" {$MonitorBrand ="天顶/Zenith"}
"UNM" {$MonitorBrand ="Unisys Corporation"}
"UNK" {$MonitorBrand ="未知/Unknown"}; Default {$MonitorBrand ="未知/Unknown"}
}
#输出标题和内容
"-"*$eCenter+$heading+"-"*$eCenter
($_ | Format-List -OutVariable "Monitor$MONCount" `
@{l='名称/型号'; e={$monIDserial[1]}}, #String
@{l='厂商'; e=($MonitorBrand+", EDID原文为"+$monIDserial[0])},
@{l='序列号'; e={$monIDserial[2]}}, #String
@{l='生产于'; e={($_.YearOfManufacture).ToString()+"年, 第"+($_.WeekOfManufacture).ToString()+"个星期"}},
@{l='计算生产时间'; e={($DateStartEst).ToString()+" 至 "+($DateEndEst).ToString()}} | Out-String).Trim()
#$Monitor0 >> D:\Desktop\1.txt; $Monitor1 >> D:\Desktop\1.txt
$MONCount+=1
}
"`n 显示器当前的固件版本一般由自带的OSA按键打开菜单-->信息中可见, 固件的更新方法以厂商官网的产品页或说明书为准`n"
"`n`n 物Physical`n 理`n 硬Disk`n 盘`n"
$PhDCount=0
Get-Disk | Select DiskNumber,PartitionStyle,HealthStatus,FirmwareVersion,FriendlyName,SerialNumber,Size,AllocatedSize,Location `
| ForEach-Object {
#标题和居中计算
[string]$heading = "盘"+$_.DiskNumber+": "+$_.FriendlyName
[int]$eCenter = $tCenter - $heading.Length/2
#输出标题和内容
"-"*$eCenter+$heading+"-"*$eCenter
($_ | Format-List -OutVariable "PhysicalDrive$PhDCount" `
@{l='分区表格式'; e={($_.PartitionStyle).Trim()}},#String
@{l='序列号'; e={$_.SerialNumber}}, #String
@{l='固件版本'; e={$_.FirmwareVersion}}, #String
@{l='设定容量'; e={[math]::Round($_.AllocatedSize / 1GB).ToString()+"GB"}},#String
@{l='实际容量'; e={[math]::Round($_.Size / 1GB).ToString()+"GB"}}, #String
@{l='健康状况'; e={$_.HealthStatus}}, #String
@{l='接口位置'; e={$_.Location}} | Out-String).Trim()
#$PhysicalDrive0 >> D:\Desktop\1.txt; $PhysicalDrive1 >> D:\Desktop\1.txt
$PhDCount+=1
}
"`n`n 逻Logical`n 辑`n 磁Disk`n 盘`n"
$LgDCount=0
Get-WMIObject -Class Win32_LogicalDisk | Select FileSystem,DeviceID,Description,Size,FreeSpace,VolumeName `
| ForEach-Object {
#标注空逻辑磁盘(备用, 因为Format-List中的代码还未测试)
if (!$_.Size) {$Capacity = "不可用(N/A)"; $DiskSpace = "不可用(N/A)"}
else {
$Capacity = "{0:n1}GB" -f($_.Size / 1GB)
$DiskSpace ="{0:n1}GB" -f($_.FreeSpace / 1GB)
}
#标题和居中计算
[string]$heading = "$DiskType"+$_.DeviceID+" "+$_.DiskNumber+$_.VolumeName
[int]$eCenter = $tCenter - $heading.Length/2
#输出标题和内容
"-"*$eCenter+$heading+"-"*$eCenter
($_ | Format-List -ShowError -OutVariable "LogicalDisk$PhDCount" `
@{l='磁盘类型'; e={$_.Description}},#String
@{l='文件系统'; e={if (!$_.FileSystem) {"不可用(N/A)"} else {$_.FileSystem}}}, #拦截空文件系统会产生的错误
@{l='逻辑容量'; e={if (!$_.Size) {"不可用(N/A)"} else {"{0:n1}GB" -f($_.Size / 1GB)}}},#String
@{l='剩余容量'; e={if (!$_.Size) {"不可用(N/A)"} else {"{0:n1}GB" -f($_.Size / 1GB)}}} | Out-String).Trim()
#$LogicalDisk0 >> D:\Desktop\1.txt; $LogicalDisk1 >> D:\Desktop\1.txt
$LgDCount+=1
}
"`n`n 音Audio`n 频`n 端Endpoint`n 口`n 于主板/显卡/USB或PCIE声卡Sound Card/音频均衡界面Audio Interface等设备,`r`n 蓝牙A2DP, USB, TOSLink, 3.5mm,4.35mm, HDMI, RCA, XLR, 1/4`" (6.35mm) TS/TRS的数字或模拟信号输入输出端口`n"
Get-PnpDevice -Class AudioEndpoint -Status OK `
| Select -Property FriendlyName,InstanceId `
| Sort-Object -Unique FriendlyName `
| Format-Table -AutoSize -ShowError -OutVariable "ConnectedAudioEndpoints" @{l='插入的音频端口';e='FriendlyName'},@{l='硬件实例ID';e='InstanceId'}
#$ConnectedAudioEndpoints >> D:\Desktop\1.txt
Try {#$ErrorActionPreference = "Stop"
Get-PnpDevice -Class AudioEndpoint -Status Unknown `
| Select -Property FriendlyName,InstanceId `
| Sort-Object -Unique FriendlyName `
| Format-Table -AutoSize -ShowError -OutVariable "VacantAudioEndpoints" @{l='空出的音频端口';e='FriendlyName'},@{l='硬件实例ID';e='InstanceId'}
} Catch [Microsoft.PowerShell.Cmdletization.Cim.CimJobException] {
Write-Verbose "× 无空出/离线的音频端口" -Verbose
}#Finally {$ErrorActionPreference = "Continue"}
#$VacantAudioEndpoints >> D:\Desktop\1.txt
" 打Printing`n 印`n 队Queue`n 列`n"
Get-PnpDevice -Class PrintQueue -Status OK `
| Select -Property FriendlyName,InstanceId `
| Sort-Object -Unique FriendlyName `
| Format-Table -AutoSize -ShowError -OutVariable "ConnectedPrintingQueue" @{l='已连接的打印设备';e='FriendlyName'},@{l='硬件实例ID';e='InstanceId'}
#$ConnectedPrintingQueue >> D:\Desktop\1.txt
Try {#$ErrorActionPreference = "Stop"
Get-PnpDevice -Class PrintQueue -Status Unknown `
| Select -Property FriendlyName,InstanceId `
| Sort-Object -Unique FriendlyName `
| Format-Table -AutoSize -ShowError -OutVariable "VacantPrintingQueue" @{l='未连接的打印设备';e='FriendlyName'},@{l='硬件实例ID';e='InstanceId'}
} Catch [Microsoft.PowerShell.Cmdletization.Cim.CimJobException] {
Write-Verbose "× 没有任何未连接的打印设备" -Verbose
}#Finally {$ErrorActionPreference = "Continue"}
#$VacantPrintingQueue >> D:\Desktop\1.txt
"`n 通Universal`n 用`n 串Serial`n 行`n 总Bus`n 线`n"
Get-PnpDevice -Class USB -FriendlyName *USB* -Status OK `
| Sort-Object -Unique FriendlyName `
| Format-Table -AutoSize -ShowError -OutVariable "ConnectedUSBDevices" @{l='连接的USB设备';e='FriendlyName'},@{l='硬件实例ID';e='InstanceId'}
#$ConnectedUSBDevices >> D:\Desktop\1.txt
Try {#$ErrorActionPreference = "Stop"
(Get-PnpDevice -Class USB -FriendlyName *USB* -Status Unknown `
| Sort-Object -Unique FriendlyName `
| Format-Table -AutoSize -ShowError -OutVariable "VacantUSBDevices" @{l='未连接的USB设备(可能是系统迁徙或旧设备残留)';e='FriendlyName'},@{l='硬件实例ID';e='InstanceId'} `
| Out-String).Trim()
if ($?) {"Get-PnpDevice 检测到未知设备残留,可以使用SPOOCQ - ghostbuster清理`n"} else {"√ Get-PnpDevice 未检测到USB设备残留,无需清理`n"}
} Catch [Microsoft.PowerShell.Cmdletization.Cim.CimJobException] {
Write-Verbose "× 没有任何未连接的USB设备" -Verbose
}#Finally {$ErrorActionPreference = "Continue"}
#$VacantUSBDevices >> D:\Desktop\1.txt
"`n AMD 驱`n Intel 动`n NVIDIA`n Realtek`n MediaTek`n"
Get-WmiObject Win32_PnPSignedDriver `
| Select DeviceName,DriverVersion,DriverDate `
| Where-Object {($_.DriverDate -ne $null) -and $_.DeviceName -cmatch 'AMD' -or $_.DeviceName -cmatch 'Radeon' -or $_.DeviceName -cmatch 'Intel' -or $_.DeviceName -cmatch 'NVIDIA' -or $_.DeviceName -cmatch 'Realtek' -or $_.DeviceName -match 'MediaTek'} `
| Sort-Object -Unique DriverDate `
| Format-Table -AutoSize -ShowError @{l='硬件';e='DeviceName'},@{l='驱动版本';e='DriverVersion';a='Right'},@{l='编译日期';e={(Get-WmiObject -Class Win32_OperatingSystem).ConvertToDateTime($_.DriverDate).ToString('yyyy-MM-dd')};a='Right'}
"`n 计Scheduled`n 划`n 任Tasks`n 务`n 该步骤可能会花费较长时间完成`n 实现开机启动, 触发启动的类Cron/Anacron任务(如设定闹钟提醒等计划), `r`n 清理掉无效或卸载残留的任务以减少系统占用, 开始菜单输入Task Scheduler打开`n"
Get-ScheduledTask -TaskPath "\" `
| Where {$_.State -eq "Ready"} `
| Select TaskName,@{l='Date';e={ if ($_.Date) { ([datetime]::Parse((($_.Date).ToString()))).ToString('yyyy-MM-dd') } else {" "}} } -OutVariable "ScheduledTasks"
#$ScheduledTasks >> D:\Desktop\1.txt
#转换PSCustomObject格式的非标准(没有Z)ISO 8601时间格式为普通时间, 再转换为yyyy-MM-dd
"`n`n 自Startup`n 启`n 动Items`n 项`n"
[string]$SysStartMenu = "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup"
[string]$UsrStartMenu = "$env:USERPROFILE\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup"
$StartupTbl = New-Object System.Data.DataTable
$StrpItmTtl = [System.Data.DataColumn]::new("文件/REG_SZ")
$StrpCmdTtl = [System.Data.DataColumn]::new("路径/命令")
$StrpUsrTtl = [System.Data.DataColumn]::new("对应用户")
$StartupTbl.Columns.Add($StrpItmTtl); $StartupTbl.Columns.Add($StrpCmdTtl); $StartupTbl.Columns.Add($StrpUsrTtl)
if (Test-Path "$SysStartMenu\*") {
$SysStartItem = Get-ChildItem "$SysStartMenu" | Select-Object Name,Directory
ForEach ($_ in $SysStartItem) {
[void]$StartupTbl.Rows.Add($_.Name, $_.Directory, "所有用户/Public")
}
} else {[void]$StartupTbl.Rows.Add("无项目(N/A)", "无项目(N/A)", "无项目(N/A)")}
if (Test-Path "$UsrStartMenu\*") {
$UsrStartItem = Get-ChildItem "$UsrStartMenu" | Select-Object Name,Directory
ForEach ($_ in $UsrStartItem) {
[void]$StartupTbl.Rows.Add($_.Name, $_.Directory, $env:USERDOMAIN+"\"+$env:USERNAME)
}
} else {[void]$StartupTbl.Rows.Add("无项目(N/A)", "无项目(N/A)", "无项目(N/A)")}
if (Get-WmiObject Win32_StartupCommand) {
$RegStartItem = Get-WmiObject Win32_StartupCommand `
| Where-Object {$_.Location -notlike "*Startup*"} `
| Select Location,Command,User `
| Sort-Object Command -Unique
ForEach ($_ in $RegStartItem) {
[void]$StartupTbl.Rows.Add($_.Location, $_.Command, $_.User)
}
} else {[void]$StartupTbl.Rows.Add("无项目(N/A)", "无项目(N/A)", "无项目(N/A)")}
($StartupTbl | Out-String).Trim()
"`r`n ... 剩余的自启动项见任务管理器Ctrl+Shift+Esc的`"启动`"菜单`n"
"`n 蓝Blue`n 牙`n 协Tooth`n 议`n " #蓝牙版本的LMP-->BT转码参考自: reddit.com/r/PowerShell/comments/vmexhm
$AllBTDcs = Get-PnpDevice -Class "Bluetooth" -PresentOnly | Where-Object {$_.FriendlyName -notmatch "Microsoft"}
$BTDvcTbl = New-Object System.Data.DataTable
$BTVersn = [System.Data.DataColumn]::new("BT")
$NameTtl = [System.Data.DataColumn]::new("设备名称")
$DvrVrsn = [System.Data.DataColumn]::new("驱动版本")
$InstcID = [System.Data.DataColumn]::new("硬件实例ID")
$BTDvcTbl.Columns.Add($BTVersn); $BTDvcTbl.Columns.Add($DvrVrsn); $BTDvcTbl.Columns.Add($NameTtl); $BTDvcTbl.Columns.Add($InstcID)
Foreach ($_ in $AllBTDcs) {
$BTDevLMP = (Get-PnpDeviceProperty -KeyName "DEVPKEY_Bluetooth_RadioLmpVersion" -InstanceId $_.InstanceID).Data #获取LMP和驱动版本两个设备属性
$BTDvrVrn = (Get-PnpDeviceProperty -KeyName "DEVPKEY_Device_DriverVersion" -InstanceId $_.InstanceID).Data
if ($BTDevLMP) {#通过设备属性计算蓝牙版本,一次一个
$BTVersion = Switch ($BTDevLMP) {
0 {'1.0b'} 1 {'1.1'} 2 {'1.2'} 3 {'2.0+EDR'} 4 {'2.1+EDR'} 5 {'3.0+HS'} 6 {'4.0'} 7 {'4.1'} 8 {'4.2'} 9 {'5.0'} 10 {'5.1'} 11 {'5.2'}
default {"× 错误"}
}
} else {$BTVersion=" "}#"... 未连接的蓝牙软硬件: "+$_.InstanceID
[void]$BTDvcTbl.Rows.Add($BTVersion, $BTDvrVrn, $_.FriendlyName, $_.InstanceId)
}
($BTDvcTbl | Sort-Object -Property "BT" -Descending | Format-Table -ShowError -AutoSize -OutVariable "BlueToothDevices" | Out-String).Trim()
#$BlueToothDevices >> D:\Desktop\1.txt
"`r`n 硬件支持的蓝牙协议版本与蓝牙音频A2DP编解码格式的支持无关,`r`n Hardware-side supported Bluetooth & A2DP audio version doesn't guarantee a software support"
" 可使用Wireshark的`"btavdtp.signel_id`"过滤以显示16进制的A2SP音频编号, 对照查询`r`n Software-side support can be found in Wireshark's `"btavdtp.signel_id`" filter, which is the hexadecimal A2DP audio codec used"
"`n`n 电Battery`n 池`n 与&`n 不Uninterruptible`n 间`n 断`n 电Powersupply`n 源"
"`r`n 详细的系统用电报告, 电池寿命报告可见于 / The detailed powerdraw & batterylife report can be found via this commandline:`r`n `"powercfg /BATTERYREPORT && powercfg /SYSTEMPOWERREPORT`""
$BTTCount=0
if (Get-CimInstance -ClassName Win32_Battery) {
Get-CimInstance -ClassName Win32_Battery | Select Name,Availability,PowerManagementSupported,Chemistry,DesignCapacity,DesignVoltage,EstimatedChargeRemaining,EstimatedRunTime `
| ForEach-Object {
Switch ($_.Availability) {
1 {[string]$btState = "放电中"}
2 {[string]$btState = "未知"}
3 {[string]$btState = "电量高"}
4 {[string]$btState = "电量低"}
5 {[string]$btState = "电量极低"}
6 {[string]$btState = "正在充电"}
7 {[string]$btState = "正在充电, 电量高"}
8 {[string]$btState = "正在充电, 电量低"}
9 {[string]$btState = "正在充电, 电量极低"}
11{[string]$btState = "未充满"}
Default{$btState = ($_.Availability).ToString()}
}
Switch ($_.Chemistry) {
1 {[string]$btChems = "其它"}
2 {[string]$btChems = "未知"}
3 {[string]$btChems = "二氧化铅硫酸/铅酸/Lead-Acid"}
4 {[string]$btChems = "镉镍/Nickel-cadmium"}
5 {[string]$btChems = "长期储电镍氢/Nickel-Metal-Hydride"}
6 {[string]$btChems = "锂离子/Lithium-ion"}
7 {[string]$btChems = "锌空气/锌氧/Zinc-Air Fuel"}
8 {[string]$btChems = "锂聚合物/Lithium Polymer"}
Default{$btChems = ($_.Availability).ToString()}
}
#标题和居中计算
[string]$heading = ($_.Name).Trim()
[int]$eCenter = $tCenter - $heading.Length/2
#输出标题和内容
"-"*$eCenter+$heading+"-"*$eCenter
($_ | Format-List -ShowError -OutVariable "BatteryUPS$BTTCount" `
@{l='设计电量'; e={if ($_.DesignCapacity -eq $null) {"不可用(N/A)"} else {($_.DesignCapacity).ToString()+"mAh"}}},#String
@{l='设计电压'; e={if ($_.DesignVoltage -eq $null) {"不可用(N/A)"} else {($_.DesignVoltage / 1000).ToString()+"V"}}},#String
@{l='预估电量'; e={($_.EstimatedChargeRemaining).ToString()+"%"}},#String
@{l='预估可用'; e={($_.EstimatedRunTime).ToString()+"分钟"}},#String
@{l='状态'; e={$btState}}, #String
@{l='系统电源管理';e={$_.PowerManagementSupported}},#String
@{l='电芯化合物'; e={$btChems}} `
| Out-String).Trim()
#$BatteryUPS0 >> D:\Desktop\1.txt; $BatteryUPS >> D:\Desktop\1.txt
$BTTCount+=1
}
} else {"`n× 电池与UPS总数为0`n"}
"`n 隐 Hidden`n 藏`n 电 Power`n 源`n 与 &`n CPU`n 调 Scheduling`n 度`n 选 Options`n 项"
Get-ChildItem 'HKLM:\SYSTEM\CurrentControlSet\Control\Power\PowerSettings' -Recurse | `
Where-Object Property -contain 'Attributes' | Get-ItemProperty | Where-Object Attributes -eq 2 | `
Select @{l='名称';e={$_.FriendlyName.Split(',')[-1]}},@{l='简介';e={$_.Description.Split(',')[-1]}},@{l='Min';e='ValueMin'},@{l='Max';e='ValueMax'},@{l='单位';e={$_.ValueUnits.Split(',')[-1]}},@{l='GUID';e='PSCHildName'} | `
Format-Table -AutoSize
" 系System`n 统`n 插Slots`n 槽"
$ConnectorType = @{
l='类型'
e={ # property is an array, so process all values
foreach($ctype in $_.ConnectorType) { Switch([int]$ctype) {
100 {'PCI-E'} 0 {'未标记/未知'} 1 {'其它'} 2 {'Male'} 3 {'Female'}
4 {'Shielded'} 5 {'Unshielded'}
6 {'SCSI (A) High-Density (50 pins)'} 7 {'SCSI (A) Low-Density (50 pins)'} 8 {'SCSI (P) High-Density (68 pins)'}
9 {'SCSI SCA-I (80 pins)'} 10 {'SCSI SCA-II (80pins)'} 11 {'SCSI Fibre Ch. (DB-9, Copper)'}12 {'SCSI Fibre Ch. (Fibre)'}13 {'SCSI Fibre Ch. SCA-II (40pins)'} 14 {'SCSI Fibre Ch. SCA-II (20pins)'} 15 {'SCSI Fibre Ch. BNC'}
16 {'ATA 3-1/2 Inch (40 pins)'} 17 {'ATA 2-1/2 Inch (44 pins)'}
18 {'ATA-2'} 19 {'ATA-3'} 20 {'ATA/66'}
21 {'DB-9'} 22 {'DB-15'} 23 {'DB-25'} 24 {'DB-36'}
25 {'RS-232C'} 26 {'RS-422'} 27 {'RS-423'} 28 {'RS-485'} 29 {'RS-449'}
30 {'V.35'} 31 {'X.21'} 32 {'IEEE-488'} 33 {'AUI'}
34 {'UTP Cat.3'} 35 {'UTP Cat.4'} 36 {'UTP Cat.5'}
37 {'BNC'} 38 {'RJ11'} 39 {'RJ45'}
40 {'Fiber MIC'} 41 {'Apple AUI'} 42 {'Apple GeoPort'}
43 {'PCI'} 44 {'ISA'} 45 {'EISA'} 46 {'VESA'}
47 {'PCMCIA'} 48 {'PCMCIA Type I'} 49 {'PCMCIA Type II'} 50 {'PCMCIA Type III'}
51 {'ZV Port'} 52 {'CardBus'} 53 {'USB'} 54 {'IEEE 1394'}
55 {'HIPPI'} 56 {'HSSDC (6 pins)'} 57 {'GBIC'}
58 {'DIN'} 59 {'Mini-DIN'} 60 {'Micro-DIN'} 61 {'PS/2'}
62 {'Infrared'} 63 {'HP-HIL'}
64 {'Access.bus'} 65 {'NuBus'}
66 {'Centronics'} 67 {'Mini-Centronics'} 68 {'Mini-Centronics Type14'} 69 {'Mini-Centronics Type20'} 70 {'Mini-Centronics Type26'}
71 {'Bus Mouse'} 72 {'ADB'} 73 {'AGP'} 74 {'VME Bus'} 75 {'VME64'}
76 {'Proprietary'}77 {'Proprietary CPU Card Slot'} 78 {'Proprietary Memory Card Slot'} 79 {'Proprietary I/O Riser Slot'}
80 {'PCI-66MHZ'} 81 {'AGP2X'} 82 {'AGP4X'}
83 {'PC-98'} 84 {'PC-98-Hireso'} 85 {'PC-H98'} 86 {'PC-98Note'} 87 {'PC-98Full'} 88 {'PCI-X'}
89 {'Sbus IEEE 1396-1993 32 bit'} 90 {'Sbus IEEE 1396-1993 64 bit'}
91 {'MCA'} 92 {'GIO'} 93 {'XIO'} 94 {'HIO'} 95 {'NGIO'} 96 {'PMC'} 97 {'Future I/O'} 98 {'InfiniBand'}
99 {'AGP8X'} $null {'BIOS未报告'} Default {$ctype.ToString()}
}}}
}
$CurrentUsage = @{
l='使用状态'
e={ $value = $_.CurrentUsage
switch([int]$value) {
0 {'保留/Reserved'} 1 {'其它/Other'}
2 {'未知/Unknown'} 3 {'正常/Normal'}
4 {'使用中/In use'} $null {'BIOS未报告'}
Default {"$value"}
}
}
}
#$MaxDataWidth = @{
# l='数据总线位宽(返回值不符合微软定义)'
# e={ ([Math]::Pow(2, $_.MaxDataWidth+3)).ToString()+"bit" }
#}
Get-CimInstance -ClassName Win32_SystemSlot `
| Select-Object -Property @{l='指定类'; e={$_.SlotDesignation}},@{l='状况';e='Status'}, $ConnectorType, @{l='支持休眠唤醒'; e={$_.PMESignal}}, @{l='可热插拔'; e={$_.SupportsHotPlug}}, $CurrentUsage `
| Format-Table -AutoSize -OutVariable $SystemSlots
" 总`n 线Bus`n 分`n 布Distribution"
Get-WMIObject Win32_DeviceBus | `
Sort-Object Antecedent,Dependent | `
Select @{l='Bus'; e={($_.Antecedent.Split("`"").Split("_") | Select -Index 4)}},
@{l='上游'; e={($_.Antecedent.Split("`"").Split("_") | Select-Object -Index 2)}},
@{l='下游'; e={($_.Dependent.Split("`"") | Select -Index 1).Split("\\") | Select -Index 0}},
@{l='设备'; e={($_.Dependent.Split("`"") | Select -Index 1).Split("\\") | Select -Index 2}} | `
Format-Table -AutoSize -OutVariable $BusDistribution
" AMD 软`n Intel 件`n NVIDIA`n Realtek`n MediaTek`n 该步骤可能会花费较长时间完成,超过30秒则按Enter`n"
Get-WmiObject -Class Win32_Product `
| Where-Object {$_.Vendor -notmatch "Microsoft"} `
| Select Name,Version `
| Where-Object {$_.Name -cmatch 'AMD' -or $_.Name -cmatch 'Intel' -or $_.Name -cmatch 'NVIDIA' -or $_.DeviceName -cmatch 'Realtek' -or $_.DeviceName -match 'MediaTek'} `
| Sort-Object -Unique Version `
| Format-Table -Autosize -ShowError @{l='软件';e='Name'},@{l='版本';e='Version';a='Right'}
Read-Host " 已完成. 用鼠标拖选,右键单击复制, 或在活动窗口上输入以下内容以导出需要的部分:
`$ScheduledTasks >> D:\1.txt
`$VacantUSBDevices >> D:\1.txt
`$ConnectedUSBDevices >> D:\1.txt
`$VacantPrintingQueue >> D:\1.txt
`$ConnectedPrintingQueue >> D:\1.txt
`$VacantAudioEndpoints >> D:\1.txt
`$ConnectedAudioEndpoints >> D:\1.txt
`$Motherboard >> D:\1.txt
`$BlueToothDevices >> D:\1.txt
`$LogicalDisk0 >> D:\1.txt; `$LogicalDisk1 >> D:\1.txt
`$PhysicalDrive0 >> D:\1.txt; `$PhysicalDrive1 >> D:\1.txt
`$Monitor0 >> D:\1.txt; `$Monitor1 >> D:\1.txt
`$GraphicsCard0 >> D:\1.txt; `$GraphicsCard1 >> D:\1.txt
`$Memory0 >> D:\1.txt; `$Memory2 >> D:\1.txt
`$Processor0 >> D:\1.txt; `$Processor1 >> D:\1.txt
`$BatteryUPS0 >> D:\1.txt; `$BatteryUPS1 >> D:\1.txt
`$BusDistribution >> D:\1.txt
`$SystemSlots >> D:\1.txt
"
}
搭配下方的Get-myPC.psd1(放于同目录), 用Import-Module Get-myPC.psm1
; Get-myPC
运行。
清单文件译自Manifest file,用于限制最低引擎版本(新PowerShell加的参数在旧版没有),锚定函数运行所需的文件(否则要自己写检测功能),注明版权和来源等方便大体积,多文件函数模组用的。以下主要为了提供例子方便后来人照搬了,正常直接用上面那段就够了。
以下清单通过New-ModuleManifest Get-myPC.psd1
生成源,再修改一些默认值就写出来了。由于系统语言是中文,所以才会给出中文的清单:
#
# 模块“Get-myPC”的模块清单
#
# 生成者: iAvoe (NazoRip@A)
#
# 生成时间: 2022/2/15
#
@{
# 与此清单关联的脚本模块或二进制模块文件。
RootModule = 'Get-myPC.psm1'
# 此模块的版本号。
ModuleVersion = '2.0'
# 支持的 PSEditions
# CompatiblePSEditions = @()
# 用于唯一标识此模块的 ID
GUID = '8d011647-95d5-4fca-ac7e-7cae5f9d74de'
# 此模块的作者
Author = 'iAvoe (NazoRip@A)'
# 此模块所属的公司或供应商
CompanyName = 'Nazorip'
# 此模块的版权声明
Copyright = '(c) 2022 iAvoe (NazoRip@A)。保留所有权利。'
# 此模块所提供功能的说明
Description = '使用Get-myPC函数获取计算机名,Windows版本,Windows体验指数跑分,以及主板,处理器,内存条,BIOS,显卡,物理磁盘和逻辑磁盘的详细信息。'
# 此模块要求的 Windows PowerShell 引擎的最低版本
PowerShellVersion = '2.0'
# 此模块要求的 Windows PowerShell 主机的名称
# PowerShellHostName = ''
# 此模块要求的 Windows PowerShell 主机的最低版本
# PowerShellHostVersion = ''
# 此模块要求使用的最低 Microsoft .NET Framework 版本。此先决条件仅对 PowerShell Desktop 版本有效。
# DotNetFrameworkVersion = ''
# 此模块要求使用的最低公共语言运行时(CLR)版本。此先决条件仅对 PowerShell Desktop 版本有效。
# CLRVersion = ''
# 此模块要求的处理器体系结构(无、X86、Amd64)
# ProcessorArchitecture = ''
# 必须在导入此模块之前先导入全局环境中的模块
# RequiredModules = @()
# 导入此模块之前必须加载的程序集
# RequiredAssemblies = @()
# 导入此模块之前运行在调用方环境中的脚本文件(.ps1)。
# ScriptsToProcess = @()
# 导入此模块时要加载的类型文件(.ps1xml)
# TypesToProcess = @()
# 导入此模块时要加载的格式文件(.ps1xml)
# FormatsToProcess = @()
# 将作为 RootModule/ModuleToProcess 中所指定模块的嵌套模块导入的模块
# NestedModules = @()
# 要从此模块中导出的函数。为了获得最佳性能,请不要使用通配符,不要删除该条目。如果没有要导出的函数,请使用空数组。
FunctionsToExport = @('Get-myPC')
# 要从此模块中导出的 cmdlet。为了获得最佳性能,请不要使用通配符,不要删除该条目。如果没有要导出的 cmdlet,请使用空数组。
CmdletsToExport = @()
# 要从此模块中导出的变量
VariablesToExport = '*'
# 要从此模块中导出的别名。为了获得最佳性能,请不要使用通配符,不要删除该条目。如果没有要导出的别名,请使用空数组。
AliasesToExport = @()
# 要从此模块导出的 DSC 资源
# DscResourcesToExport = @()
# 与此模块一起打包的所有模块的列表
# ModuleList = @()
# 与此模块一起打包的所有文件的列表
FileList = @('Get-myPC.psm1')
# 要传递到 RootModule/ModuleToProcess 中指定的模块的专用数据。这还可能包含 PSData 哈希表以及 PowerShell 使用的其他模块元数据。
PrivateData = @{
PSData = @{
# 应用于此模块的标记。这些标记有助于在联机库中执行模块发现。
# Tags = @()
# 指向此模块的许可证的 URL。
# LicenseUri = ''
# 指向此项目的主网站的 URL。
# ProjectUri = ''
# 指向表示此模块的图标的 URL。
# IconUri = ''
# 此模块的 ReleaseNotes
# ReleaseNotes = ''
} # PSData 哈希表末尾
} # PrivateData 哈希表末尾
# 此模块的 HelpInfo URI
# HelpInfoURI = ''
# 从此模块中导出的命令的默认前缀。可以使用 Import-Module -Prefix 覆盖默认前缀。
# DefaultCommandPrefix = ''
}
Powershell做不到实时监测CPU每个线程的占用,也不能测试内存稳定性。实现方法太难...
PS: 其实吧,这东西的最大用处还是在硬件论坛提问的时候生成个硬件信息报告...
更新4:增加了存在和未知USB设备的检测步骤
更新5-6:改良了供电状态powerstate参数, 以及CPU L2, L3缓存大小.
更新7:改良了内存信息检测,将速度参数改为当前运行速度,增加了物理库(RANK)信息,Bus位宽信息
更新8:增加了高科技:显示器信息检测和计算(循环+ASCII解码得Unicode值),增加了MediaTek的软件名搜索
更新9-1:增加了检测所有音频端口,方便检测DAC/声卡/音频均衡界面存在,以及接口是否正常插入的功能
更新9-2:增加了检测打印队列/打印机的功能
更新10:增加了自动将69种EDID厂商代号翻译为56种已知电脑电视显示器厂商,包括中文名的转码器
更新11:修复了一处打印队列的回执文字内容错误,增加了检测蓝牙设备,支持蓝牙版本(LMP号码自动转码)以及驱动版本的功能
更新12:增加检测计划任务(Scheduled Tasks)的功能,增加检测用户开始菜单,全局开始菜单以及注册表三种自启动项(命令或程序)的功能,BIOS检测栏目的发行日期转换为yyyy-MM-d格式,标题长度(横杠数量)改为36
更新13:检测自启动项的输出文本的排版美化,增加了蓝牙版本与支持音频编码无关的提醒,标题长度(横杠数量)恢复到28
更新18:显示器检测功能增加了根据星期数来计算生产日期的算法(精确到7天,规范为yyyy-MM-dd格式),每个检测功能都增加了对应的数据输出参数增加了脱机状态(Power State 8)的CPU-GPU状态,增加了提醒通过(基于脚本当前路径生成的)命令运行脚本以保留交互窗口的提醒,通过Format-List的高级排版进行了所有功能的代码重构(减少了1/3的代码行数,虽然后面又增加了一些新的东西),并且改用了紧凑的打印排版,修复了一点细节性疏漏;添加了Win32驱动时间格式的解码算法并将显卡驱动发行日期规范为了yyyy-MM-dd格式
更新19:增加了检测笔记本电脑电池,服务器电池,以及不间断电源UPS的功能
更新20:改进了音频端口的说明,改良了初始说明内容,增加了全屏运行建议,强化了段落标题排版,部分多目标表格恢复到对象Object模式以保证输出内容可以根据PowerShell窗口分辨率变化而自动重排,增加了如何通过输入导出项目来将内容打印到文本的说明,整理了顶部内容排版
更新21:内存检测部分增加了自动转码芯片类型,自动计算理论单条内存最高带宽以及其总和的算法
更新22:修复了检测当前负载和虚拟化流程的计算失败错误
更新23:增加了方便软件开发用,分别给出主显示器宽和高的功能
更新24:增加了如何更新显示器固件的说明,以及某些步骤用时较长的提醒
更新25:增加了自动调用nvidia-smi.exe来显示更详细显卡信息的功能
更新26:修复了GPU栏目的"状态"项目失效的问题,优化了软件部分的提醒,增加了软件部分的说明,增加了隐藏电源与CPU调度选项,系统插槽,以及系统总线分布3个新栏目,将速度最慢的软件部分移动到脚本末尾
更新27:增加了对笔记本显示屏幕的空序列号兼容性,以前版本会导致错误;整理了开头部分的内容编排,增加了笔记本检测独立显卡需切换显卡的提醒,增加了开头部分的英语翻译,增加了蓝牙/A2DP部分的英语翻译,增加了电池部分获取系统用电报告以及电池寿命报告的方法提醒以及其英文
那么就这样!
打赏信息
在线丢人,求个打赏,支持一下T_T
[...]命令行交互 Commandline interface CLI:在如 Terminal、Bash、CMD 和 PowerShell 的终端环境中,用户可以手动输入命令并按回车键查看结果。通常,只要输出结果有一定的文本排版,就可以轻松阅读。随着使用的增加,CLI 可能反而会变得比 GUI 更方便。然而,由于某些命令太长,而且需要储存变量,因此为了简化操作,人们会将其写作批处理、Shell 等命令脚本[...]