Search the Community
Showing results for tags 'Retrieves installed info'.
-
Several years ago, June of 2010, I modified this function by >JSThePatriot, and then made a small utility of it, called: InstalledSoftwareViewer.au3 Recently, I revisited that function, and came up with this: ; Last Updated: April 17, 2014 #RequireAdmin #include 'array.au3' Local $a = _ComputerGetSoftware() If Not @error Then _ArrayDisplay($a) EndIf Exit ;=============================================== ; #FUNCTION _ComputerGetSoftware() ; Author: JSThePatriot ; http://www.autoitscript.com/forum/topic/29404-computer-info-udfs/?hl=%20_computergetsoftware ; ; Modified by ripdad: April 15, 2014 ; ; Remarks: ; Last two columns are bits (0 or 1). ; Blank Fields = no value found ;=============================================== Func _ComputerGetSoftware() Switch @OSArch Case 'X64' Local $sHKCU = 'HKEY_CURRENT_USER64', $sHKLM = 'HKEY_LOCAL_MACHINE64' Local $sSubKey1 = '\Software\Microsoft\Windows\CurrentVersion\Uninstall' Local $sSubKey2 = '\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall' Local $aKeys[4] = [3, $sHKCU & $sSubKey1, $sHKLM & $sSubKey1, $sHKLM & $sSubKey2] Case 'X86' Local $sHKCU = 'HKEY_CURRENT_USER', $sHKLM = 'HKEY_LOCAL_MACHINE' Local $sSubKey = '\Software\Microsoft\Windows\CurrentVersion\Uninstall' Local $aKeys[3] = [2, $sHKCU & $sSubKey, $sHKLM & $sSubKey] Case Else Return SetError(1) EndSwitch Local $array[5001][7] = [[5000, 'DisplayVersion', 'Publisher', 'UninstallString', 'InstallDate', 'MSI', 'NoRemove']] Local $sAppKey, $sDisplayName, $sKey, $UnInstKey, $index = 0 For $i = 1 To $aKeys[0] $sKey = $aKeys[$i] For $j = 1 To $array[0][0] $sAppKey = RegEnumKey($sKey, $j) If @error Then ExitLoop $UnInstKey = $sKey & '\' & $sAppKey $sDisplayName = RegRead($UnInstKey, 'DisplayName') Select Case @error Case Not StringLen(StringStripWS($sDisplayName, 8)) Case StringRegExp($sDisplayName, '(?i)(KB\d+)') Case RegRead($UnInstKey, 'SystemComponent') Case RegRead($UnInstKey, 'ParentKeyName') Case Else $index += 1 $array[$index][0] = StringStripWS(StringReplace($sDisplayName, ' (remove only)', ''), 3) $array[$index][1] = StringStripWS(RegRead($UnInstKey, 'DisplayVersion'), 3) $array[$index][2] = StringStripWS(RegRead($UnInstKey, 'Publisher'), 3) $array[$index][3] = StringStripWS(RegRead($UnInstKey, 'UninstallString'), 3) $array[$index][4] = StringStripWS(RegRead($UnInstKey, 'InstallDate'), 3) $array[$index][5] = StringStripWS(RegRead($UnInstKey, 'WindowsInstaller'), 3) = 1 $array[$index][6] = StringStripWS(RegRead($UnInstKey, 'NoRemove'), 3) = 1 EndSelect Next Next ReDim $array[$index + 1][7] $array[0][0] = $index _ArraySort($array, 0, 1) Return $array EndFunc In the previous versions, HKCU was not checked for uninstalls. I decided to run a test, using that key, and what do you know... Five more entries were found! So, I decided to run some other test's, and found some more! Imagine that! Well anyways, this script, should cover most of them. If you have any questions - please let me know.