有没有办法(在 C# 中,使用 WMI 类)来找出特定软件已安装和卸载了多少次?
我想在远程计算机上运行它。我通过以下代码获取软件列表:
ManagementScope scope = new ManagementScope(@"\\" + ipAddress + @"\root\cimv2");
ObjectQuery query = new ObjectQuery("Select * from Win32_Product");
ManagementObjectSearcher searcher = new ManagementObjectSearcher(scope, query);
ManagementObjectCollection queryCollection = searcher.Get();
foreach (ManagementObject m in queryCollection)
{
Console.Write(m["Caption"]+"\t");
Console.WriteLine(m["installDate"]);
}