Collect the list of software installed on your computer and the installation list of your computer

Source: Internet
Author: User

Collect the list of software installed on your computer and the installation list of your computer

The company's IT engineers chatted with me one day and said that there was no program capable of counting software installed on the computer. The company adopted domain control, then, place the software in the Group Policy of the domain control, and set it as long as the system runs automatically during the domain control, and then write the collected information to the shared directory, in this way, the statistics of one machine are not used.
At that time, I directly wrote a console program using C. The Code is as follows:

Static void Main (string [] args) {string path = @ "\ 192.168.10.20.\ \ hard_info \"; StringBuilder proinfo = new StringBuilder (); string uninstallKey = @ "SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Uninstall"; using (RegistryKey rk = Registry. localMachine. openSubKey (uninstallKey) {foreach (string skName in rk. getSubKeyNames () {using (RegistryKey sk = rk. openSubKey (skName) {try {var displayName = Sk. GetValue ("DisplayName"); if (displayName! = Null) {proinfo. appendLine (displayName. toString () ;}} catch {}}} File. writeAllText (path + Dns. getHostName () + ". txt ", proinfo. toString (); Environment. exit (0 );}View Code

After running, statistics can be made, but a lot of software is missing. There is only one part. After some online queries, we find that we need to distinguish between 64-bit operating systems and 32-bit systems, and between LocalMachine and CurrentUser.

For x86 systems

HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Uninstall

HKEY_CURRENT_USER \ SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Uninstall


For x64 Systems

HKEY_LOCAL_MACHINE \ SOFTWARE \ Wow6432Node \ Microsoft \ Windows \ CurrentVersion \ Uninstall

HKEY_CURRENT_USER \ SOFTWARE \ Wow6432Node \ Microsoft \ Windows \ CurrentVersion \ Uninstall

Based on the above, the improved code is as follows:

 

Static void Main (string [] args) {string path = @ "\ 192.168.10.20.\ \ hard_info \"; StringBuilder proinfo = new StringBuilder (); proinfo = ShowAllSoftwaresName (); file. writeAllText (path + Dns. getHostName () + ". txt ", proinfo. toString (); Environment. exit (0);} public static StringBuilder DisplayInstalledApps (RegistryKey key) {StringBuilder result = new StringBuilder (); string displayName; if (key! = Null) {foreach (String keyName in key. getSubKeyNames () {RegistryKey subkey = key. openSubKey (keyName); displayName = subkey. getValue ("DisplayName") as string; if (! String. isNullOrEmpty (displayName) {result. appendLine (displayName) ;}} return result;} public static StringBuilder ShowAllSoftwaresName () {StringBuilder proinfo = new StringBuilder (); RegistryKey key; // search in: CurrentUser key = Registry. currentUser. openSubKey (@ "SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Uninstall"); proinfo. append (DisplayInstalledApps (key); // search in: LocalMachine_32 key = Registry. localMachine. openSubKey (@ "SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Uninstall"); proinfo. append (DisplayInstalledApps (key); // search in: CurrentUser_64 key = Registry. currentUser. openSubKey (@ "SOFTWARE \ Wow6432Node \ Microsoft \ Windows \ CurrentVersion \ Uninstall"); proinfo. append (DisplayInstalledApps (key); // search in: LocalMachine_64 key = Registry. localMachine. openSubKey (@ "SOFTWARE \ Wow6432Node \ Microsoft \ Windows \ CurrentVersion \ Uninstall"); proinfo. append (DisplayInstalledApps (key); return proinfo ;}View Code

 

After running, all the software installed on the computer is collected.

After sending the message to IT engineers, I reported that some computers cannot run... XP system not supported... Framework is not installed by default.

After finally discussing with IT engineers, we can use VBS. We have also written about VBS before, and I wrote one on the Internet to find information, which is a perfect solution.

The attachment is a vbs script. vbsobtains the software pai.zip.

References:

VBScript: Check the target computer software list

PowerShell quickly and efficiently obtains the list of installed software

Uninstall Registry Key

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.