当前位置:网站首页>Dotnet using WMI software acquisition system installation
Dotnet using WMI software acquisition system installation
2022-08-04 20:56:00 【Lin Dexi】
This article tells you how to get the software installed by the system through WMI, this method cannot get all the software
The software installed by the system can be obtained through Win32_Product
var mc = "Win32_Product";var managementObject = new[]{"Caption","Description","IdentifyingNumber","InstallDate","InstallLocation","HelpLink","HelpTelephone","InstallSource","Language","LocalPackage","Name","PackageCache","PackageCode","PackageName","ProductID","RegOwner","RegCompany","SKUNumber","Transforms","URLInfoAbout","URLUpdateInfo","Vendor","WordCount","Version",};ManagementClass managementClass = new ManagementClass(mc);ManagementObjectCollection managementObjectCollection = managementClass.GetInstances();var str = new StringBuilder();foreach (ManagementObject m in managementObjectCollection){foreach (var temp in managementObject){try{str.Append(temp);str.Append(" ");str.Append(m[temp]?.ToString() ?? "");str.Append("\n");}catch (Exception e){Console.WriteLine(temp + " " + e);}}str.Append("\n");}return str.ToString();Output the content of str
Caption : Nut CloudDescription : Nut CloudIdentifyingNumber : {FEA8B01C-3F43-470A-BB28-679B1AEEC6E8}InstallDate : 20180305InstallLocation : C:\Program Files\Nutstore\HelpLink : http://help.jianguoyun.comHelpTelephone :InstallSource : C:\Users\linde\AppData\Roaming\NutstoreClient\install\AEEC6E8\Language : 2052LocalPackage : C:\WINDOWS\Installer\4acb3a9.msiName : Nut CloudPackageCache : C:\WINDOWS\Installer\4acb3a9.msiPackageCode : {3802EFD2-0953-4527-835E-E4C459062CD5}PackageName : Nutstore.x64.msiProductID :RegOwner :RegCompany :SKUNumber :Transforms : C:\WINDOWS\Installer\{FEA8B01C-3F43-470A-BB28-679B1AEEC6E8}\Nutstore.mstURLInfoAbout : https://www.jianguoyun.com/URLUpdateInfo :Vendor : Shanghai Yicun Network Technology Co., Ltd.WordCount : 0Version : 4.0.8Caption : Apple Application Support (32-bit)Description : Apple Application Support (32-bit)IdentifyingNumber : {5A659BE5-849B-484E-A83B-DCB78407F3A4}InstallDate : 20190221InstallLocation : C:\Program Files (x86)\Common Files\Apple\Apple Application SupportHelpLink : http://www.apple.com/cn/support/HelpTelephone: (86) 800 810 2323InstallSource : C:\Users\linde\AppData\Local\Temp\IXP246.TMP\Language : 2052LocalPackage : C:\WINDOWS\Installer\1a1ef7b.msiName : Apple Application Support (32-bit)PackageCache : C:\WINDOWS\Installer\1a1ef7b.msiPackageCode : {F3D0B996-B6DB-4283-9565-004518A6610B}PackageName : AppleApplicationSupport.msiProductID :RegOwner :RegCompany :SKUNumber :Transforms :URLInfoAbout : http://www.apple.com/en/URLUpdateInfo : http://www.apple.com/cn/Vendor : Apple Inc.WordCount : 0Version : 7.3边栏推荐
猜你喜欢

C语言小笔记+题

Desthiobiotin衍生物Desthiobiotin-PEG4-Amine/Alkyne/Azide/DBCO

暴雨中的人

大资本已开始逃离加密领域?

【C语言】指针和数组的深入理解(第三期)

项目难管理?先学会用好甘特图(内附操作方法及实用模板)

【学术相关】清华教授发文劝退读博:我见过太多博士生精神崩溃、心态失衡、身体垮掉、一事无成!...

SAP ABAP OData 服务如何支持 $select 有选择性地仅读取部分模型字段值试读版

面试官:Redis中过期的key是怎么被删除的?

After the tester with 10 years of service "naked resignation" from the big factory...
随机推荐
c语言小项目(三子棋游戏实现)
uwp ScrollViewer content out of panel when set the long width
Unreal 本地化 国家化 多语言
DICOM医学影像协议
新式茶饮,卷完水果还能卷什么?
mdk5.14 cannot be burned
Getting Started with Lattice Passwords
PowerCLi 导入License到vCenter 7
IPV6地址
Retrofit的使用及原理详解
Red5搭建直播平台
Web3安全风险令人生畏,应该如何应对?
经验分享|盘点企业进行知识管理时的困惑类型
C语言之实现扫雷小游戏
简单理解 JS 事件循环
Interviewer: How is the expired key in Redis deleted?
MATLAB中readtimetable函数用法
推荐系统_刘老师
Big capital has begun to flee the crypto space?
vs Code runs a local web server