Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Executing msi file ????

Status
Not open for further replies.

DanielXIX

Programmer
Jul 31, 2005
18
TR
Hi all,
Here my code ,i tried to execute msi file but it didnt work for me,

System.Diagnostics.ProcessStartInfo proc = new System.Diagnostics.ProcessStartInfo(@"msiexec.exe");

proc.WorkingDirectory = @"c:\windows\system32\";
proc.Arguments = "/passive /i " + @"C:\TEMP\MySetup.msi";
proc.UseShellExecute = false;
proc.UserName = myusername;
proc.Password = mypassword
Process p = Process.Start(proc);


and my question is ,

how can i execute msi file with administrator password , from restricted user account?
is it possible?


thanx...

 
thanx for ur reply
i used runas class in that article and i solved my problem .
but one more thing,it throws exception from exitcode property of process class.


has anyone encountered this problem before???

here my code...

internal void ExecuteMsi()
{
Process proc=RunAs.StartProcess(Shared.username, System.Environment.UserDomainName, Shared.password, commandline);

proc.WaitForExit();
// HERE,WAITS FOR EXIT BUT NOT RETURNS ANY EXITCODE..
if (proc.ExitCode == 0)
{
MessageBox.Show("Successful");
}
}
catch (Exception ex)
{
throw ex;
}

}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top