可以使用 WMI 来检测以下内容:
- 文本缩放
- 屏幕分辨率
- 多显示器配置/布局
?
我明白Win32_DesktopMonitor
,但它似乎没有给我任何这方面的信息。
答案1
文本缩放:存储在这两个用户注册表中的值:
# AllUsers setting, which shows as (default)
(Get-ItemProperty "HKCU:\Control Panel\Desktop\WindowMetrics").AppliedDPI
# User's current scaling settings for each monitor
(Get-ItemProperty "HKCU:\Control Panel\Desktop\PerMonitorSettings\*").DpiValue
# AppliedDPI shows the "Default" scaling setting on a system level like:
96 : 100%
120 : 125%
144 : 150%
192 : 200% # (my default)
# DpiValue shows how many steps up or down *from Default* the current user's scaling setting is.
# For example on my machine:
DpiValue : 2 # +2 = 250%
DpiValue : 0 # +0 = 200% (default)
DpiValue : 4294967294 # -1 = 150%
DpiValue : 4294967292 # -3 = 100%
监视器布局:
Add-Type -AssemblyName System.Windows.Forms
[System.Windows.Forms.Screen]::AllScreens
屏幕分辨率:使用AllScreens
上面的枚举,或者以下之一:
Get-CimInstance Win32_DesktopMonitor | select Name,Screen*
Get-CimInstance CIM_VideoController | Select Name,Current*