문제

I have a fast question: IS there any other places in the registry but this:

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

where I can find the installed applications of a system? I am asking that because for example IExplorer is not in none of those registers. Where else have I to look?? I need ALL the places where a application that is installed can be.

Thanks for your help ;)

도움이 되었습니까?

해결책

Your most reliable option is probably to use Windows Management Interface (WMI) to enumerate the software installed by Windows Installer.

See Here
Enumerating Installed Software
Win32_Product class

Note that this does not guarantee that Internet Explorer is going to show up there. I think you can safely assume that Internet Explorer is going to be present on every Windows computer currently out there; Microsoft views it as part of the operating system.

You can, however, find out which version of IE is installed.

다른 팁

The paths in the question don't include the apps installed on a user level.

They are in the same location, but under HKEY_CURRENT_USER instead of HKEY_LOCAL_MACHINE.

So in total:

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

But as you can tell, HKEY_CURRENT_USER only applies to the current user.

To access all the users there is the HKEY_USERS registry root, which has a folder for each user.

So instead, you need:

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

for each user sid under HKEY_USERS:
  HKEY_USERS\<user sid>\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
  HKEY_USERS\<user sid>\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall

P.S. If you want to match between a user's SID and its name, you can look in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\<user sid> for the key named ProfileImagePath, which should equal C:\Users\<user name>. Not all users have this key, I think these are system users or something which you don't want to touch.

I was looking for this information, but after a while, I remembered that I had written a program for it. For everyone, or for me in the future.

class Program
{
    //using Microsoft.Win32;
    //using System.IO;
    static void Main(string[] args)
    {
        string uninstallKey = "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall";
        RegistryKey regKey = Registry.LocalMachine.OpenSubKey(uninstallKey);
        string[] subKey = regKey.GetSubKeyNames().Select((c)=>
        {
            RegistryKey rk = regKey.OpenSubKey(c);
            string displayName = (string)rk.GetValue("DisplayName");
            if (string.IsNullOrEmpty(displayName)) return "";
            return displayName + string.Format(" => [{0}]", c);
        }).ToArray<string>();
        string filename = "ProgramList.txt";
        if (File.Exists(filename)) File.Delete(filename);
        StreamWriter sw = File.CreateText(filename);
        foreach (string appName in subKey.OrderBy(c=>c))
        {
            if (appName != "" && !appName.StartsWith("{"))
            {
                Console.WriteLine(appName);
                sw.WriteLine(appName);
            }
        }
        sw.Close();
    }
}

#Reg.exe is in system32 but works if you copy to your script source path...# reg.exe query \servername\HKLM\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top