Click here to Skip to main content
15,042,814 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi all,
I am new to the coding.
I want to connect to the remote machine and through its registry want to retrieve the values of the software installed on the machine.The properties which i am looking for are Display name,Publisher,install date.If i am using openremotebase registry it works only for the servers,my main aim to fetch the software installed on any machine in my domain.i will be very grateful if anyone can help me out.Maximum thing i can do is to impersinate cant give usernm n passwrd.I am having admin privilages.Need it urgently.
My code :

ConnectionOptions optionst = new ConnectionOptions();
            optionst.Impersonation = ImpersonationLevel.Impersonate;
            optionst.EnablePrivileges = true;
            optionst.Authority = "NTLMDOMAIN:" + "";
            ManagementScope myScope = new ManagementScope("\\\\" + strcompname + "\\root\\default", optionst);
            ManagementPath myPath = new ManagementPath("StdRegProv");
            ManagementClass mc = new ManagementClass(myScope, myPath, null);
            mc.Scope = myScope; 
            string sSubKeyName = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall;"

            object[] methodParams = new object[] { hDefKey, sSubKeyName, null };

RegistryKey regKey = RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine, strcompname, Microsoft.Win32.RegistryView.Registry64);
                    regKey = regKey.OpenSubKey(sSubKeyName);
foreach (string entry in names)

Updated 24-Dec-13 2:36am
John d. Bartels 26-Dec-13 9:51am
You can also use wmi to retrieve this information; I am not sure if the win32_product class has all of the same information that you need or not. The wmi query would be: "Select * from win32_product". If you want to verify that all of the info is there prior to coding out the solution, jump on powershell and perform a gwmi query to see the information. "gwmi -computername RemoteComp1 -query "Select * from win32_product""

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900