如何使用 WMI 确定操作系统平台? [英] How to determine OS Platform with WMI?
问题描述
我想弄清楚 WMI 中是否有一个位置可以返回可在所有"版本的 Windows 上运行的操作系统架构(即 32 位或 64 位).当我发现以下内容时,我以为我已经想通了,看看我的 Win2k8 系统:
I am trying to figure out if there is a location in WMI that will return the OS Architecture (i.e. 32-bit or 64-bit) that will work across "all" versions of Windows. I thought I had figured it out looking at my Win2k8 system when I found the following:
Win32_OperatingSystem / OSArchitecture
我错了.Win2k3 系统上似乎不存在此字段.啊!
I was wrong. It doesn't appear that this field exists on Win2k3 systems. Argh!
那么,有没有人知道 WMI 中的另一个字段在不同服务器版本中相同"?如果不是,那么相同的注册表项呢?我使用的工具只允许我配置简单的字段查询,所以我不能使用复杂的脚本来执行.
So, is anyone aware of another field in WMI that "is" the same across server versions? If not, what about a registry key that is the same? I am using a tool that only allows me to configure simple field queries, so I cannot use a complex script to perform.
任何帮助将不胜感激.
推荐答案
经过一段时间的搜索和测试,我想出了一个修复/答案",尽管这并不是我所希望的.通过注册表执行查询在我实验室中的 Win2k3 & 的所有版本中似乎都是一致的.Win2k8.这是我从中提取信息的地方:
After awhile of searching and testing, I've come up with a "fix/answer" although it's not exactly what I was hoping for. Performing the query from via the Registry appears to be consistent across all the version I have in my lab for Win2k3 & Win2k8. Here's where I am pulling the information from:
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager\Environment
KEY: PROCESSOR_ARCHITECTURE
它显示 x86 或 AMD64.它并不完美,但至少每次都能给我正确的答案.
It displays x86 or AMD64. It's not perfect, but at least it gives me the proper answer every time.
不过,如果有人知道将输出 32/64、32 位/64 位或 X86/X64 的一致类"或注册表项,我将不胜感激.
Still, if anyone knows a consistent 'Class' or Registry key that will output 32/64, 32-bit/64-bit, or X86/X64, I would greatly appreciate the information.
这篇关于如何使用 WMI 确定操作系统平台?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!