1
    static void Main ( )
    {           
        #region runasadmin
        ProcessStartInfo proc = new ProcessStartInfo ( );
        proc.WindowStyle = ProcessWindowStyle.Normal;
        proc.FileName = Application.ExecutablePath;
        proc.CreateNoWindow = true;
        proc.UseShellExecute = false;
        //proc.Verb = "runas";
        #endregion   

            Application.EnableVisualStyles ( );
            Application.SetCompatibleTextRenderingDefault ( false );
            Application.Run ( new TotalPSTRepair (  ) );                                                
    }

We use this code to run as admin purpose but while running, the .exe file still UAE prompt was not shown. I tried all possible ways like changing .manifest file and still it was not working. Please can anybody help me out with this issue?

pimarc
  • 3,621
  • 9
  • 42
  • 70
  • Could you please explain what options have you tried and that didn't work. – Avishek Bhattacharya Apr 26 '18 at 06:34
  • Possible duplicate of [Elevating process privilege programmatically?](https://stackoverflow.com/questions/133379/elevating-process-privilege-programmatically) – Alex Apr 26 '18 at 08:40

1 Answers1

0

You could try the following:

  • Type UAC in the windows start menu and select Change User Access Control Settings, then set it to highest.

  • Open the Run dialog using WinKey + R and type control userpasswords2, then select your username, select properties, then select the membership tab and set yourself to administrator if it is not already done.

  • After restarting windows, open the Command prompt as administrator (type command in the start menu), and enter sfc /scannow : it will attempt to fix your system errors.

To know more about the System file check (SFC), have a look at this windows forum article: https://answers.microsoft.com/en-us/windows/forum/windows_10-update/system-file-check-sfc-scan-and-repair-system-files/bc609315-da1f-4775-812c-695b60477a93

pimarc
  • 3,621
  • 9
  • 42
  • 70