how to get the List of Software installed in Server machine

Ssj_Kumar
Posted by Ssj_Kumar under C# category on | Points: 40 | Views : 656
ConnectionOptions options = new ConnectionOptions();
options.Username = <<DomainNam>>\<<UserName>>;
options.Password = <<Password>>;
ManagementScope scope = new ManagementScope("\\\\" + <<ServerName>> + "\\root\\cimv2", options);
scope.Connect();
ObjectQuery query = new ObjectQuery("SELECT * FROM Win32_Product");
ManagementObjectSearcher searcher = new ManagementObjectSearcher(scope, query);
ManagementObjectCollection queryCollection = searcher.Get();
foreach (ManagementObject m in queryCollection)
{
Softwares lstTemp = new Softwares();
lstTemp.Name = m["Name"].ToString();
lstTemp.Version = m["Version"].ToString();
lstItems.Add(lstTemp);
}

Comments or Responses

Login to post response