c# - msiexec /qn Switch Prevents Uninstall -


i'm trying uninstall application via c# using following call:

msiexec.exe /x {my-product-code} /qn 

without /qn switch, dialog appear asking if want uninstall. /qn switch suppresses dialog, appears cause implicit "no" dialog result, because application not uninstall. if leave off /qn switch, dialog expected , if choose "yes", application uninstalls.

how can use /qn switch without causing implicit "no" confirmation?

as phildw noted in comment above, issue 1 of needing elevate privileges. though i'm administrator, using /qn switch suppresses confirmation dialog (as expected), , confirmation dialog used administrative confirmation it's ok uninstall. solution follows:

process process = new process(); process.startinfo.filename = "msiexec.exe"; process.startinfo.arguments = string.format("/x {0} /qn /l*v uninstall.log", productcode); process.startinfo.useshellexecute = true; // added elevate privileges process.startinfo.verb = "runas"; // added elevate privileges process.start(); process.waitforexit(); 

Comments

Popular posts from this blog

Email notification in google apps script -

c++ - Difference between pre and post decrement in recursive function argument -

javascript - IE11 incompatibility with jQuery's 'readonly'? -