Usually due to higher security settings in Windows VISTA ,Windows 7 machines we often need to run our application / setup exe by right clicking on the file and using [Run as Administrator] option.
But it can done programmatically too. The sample code given below demonstrates it.
[VB.NET CODE STARTS]
Dim procInfo As New ProcessStartInfo() procInfo.WindowStyle = ProcessWindowStyle.Hidden procInfo.UseShellExecute = True procInfo.FileName = My.Application.Info.DirectoryPath & "\MYInstaller\setup.exe" procInfo.WorkingDirectory = "" If (My.Computer.Info.OSFullName.ToString.Contains("Vista") = True) Or _ (My.Computer.Info.OSFullName.ToString.Contains("Windows 7") = True) Then procInfo.Verb = "runas" End If Process.Start(procInfo)
[VB.NET CODE ENDS]