Click here to Skip to main content
15,892,927 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

We have a requirement where in we have to be able to silently install any software component that is packaged as an EXE.
Please find below the code that we have written to accomplish this.
However, we notice that this is consistently not working with all EXE's.
For e.g. When trying to install Resharper, we were prompted with the "Install" button.
Please advice as to how we can bypass any prompts and carry on with the installation.

// Get the object on which the method will be invoked
ManagementClass processClass = new ManagementClass("Win32_Process");

// Get an input parameters object for this method
ManagementBaseObject inParams =processClass.GetMethodParameters("Create");

// Fill in input parameter values
inParams["CommandLine"]=@"c:\Users\User\Documents\JetBrains.ReSharperUltimate.2015.1.3.exe /L=1033 /S /NRC ";

// Execute the method
ManagementBaseObject outParams =processClass.InvokeMethod("Create",inParams, null);

// Display results
// Note: The return code of the method is provided in the "returnValue" property of the outParams object

String returnValue = outParams["returnValue"].ToString();

Console.WriteLine("Creation of process returned: " + outParams["returnValue"]);
Console.WriteLine("Process ID: " + outParams["processId"]);



Thanks,
Kalyani
Posted
Comments
Richard MacCutchan 25-Aug-15 5:06am    
You cannot bypass prompts that are system generated. That would be a breach of security and allow you to damage or otherwise compromise the user's system.
Richard MacCutchan 25-Aug-15 8:05am    
I mean that you cannot bypass prompts.

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



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