-1
我正試圖編寫一個返回一些系統信息的程序。我在C#中使用WMI,但它似乎無法返回所需的全部信息。獲取WMI不返回的系統信息 - C#
例如我所需要的系統內存信息,下面是WMI返回:
,並在這裏有什麼其他程序返回:
WMI不能返回「製造「或」MemoryType「,那麼我如何保留這些信息?
我正試圖編寫一個返回一些系統信息的程序。我在C#中使用WMI,但它似乎無法返回所需的全部信息。獲取WMI不返回的系統信息 - C#
例如我所需要的系統內存信息,下面是WMI返回:
,並在這裏有什麼其他程序返回:
WMI不能返回「製造「或」MemoryType「,那麼我如何保留這些信息?
試試這個代碼:
ConnectionOptions connection = new ConnectionOptions();
connection.Impersonation = ImpersonationLevel.Impersonate;
ManagementScope scope = new ManagementScope("\\root\\CIMV2", connection);
scope.Connect();
ObjectQuery query = new ObjectQuery("SELECT * FROM Win32_PhysicalMemory");
ManagementObjectSearcher searcher = new ManagementObjectSearcher(scope, query);
foreach (ManagementObject queryObj in searcher.Get())
{
Console.WriteLine("-----------------------------------");
foreach (PropertyData data in queryObj.Properties)
Console.WriteLine(data.Name + "\t" + data.Value);
}
謝謝,但它不會返回完整的信息。我使用CPU-Z應用程序,它返回RAM的製造,但WMI不能。 – Nofuzy
http://www.dmtf.org/sites/default/files/standards/documents/DSP0134_2.7.1.pdf – itsme86
@celerno這是Perl中,這是C#! –
@JeremyThompson對不起,沒有看到標籤。我通常關注代碼片段。 – celerno