Run process as administrator from a non-admin application

You must use ShellExecute. ShellExecute is the only API that knows how to launch Consent.exe in order to elevate. Sample (.NET) Source Code In C#, the way you call ShellExecute is to use Process.Start along with UseShellExecute = true: private void button1_Click(object sender, EventArgs e) { //Public domain; no attribution required. ProcessStartInfo info = new … Read more

How to set “Run this program as an administrator” programmatically

You can programmatically set the “Run this program as an administrator” flag (the option you find in the Compatibility tab of an EXE’s properties), by setting a simple registry key. You need to create a string value (REG_SZ) under one of these keys (if you want the setting to be per user or per machine, … Read more

How do I ‘run as’ ‘Network Service’?

Use PsExec.exe from SysInternals, running from an elevated command prompt. e.g. this will open a new command prompt running as NETWORK SERVICE: psexec -i -u “nt authority\network service” cmd.exe this will run it as LOCAL SYSTEM: psexec -i -s cmd.exe You can verify these by running whoami from the cmd prompt. See also: http://forum.sysinternals.com/how-to-start-cmdexe-as-network-service_topic15797.html Interactive … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)