Sunday, 15 May 2011

c# - Execute EXE file to run command as administrator on restricted user -



c# - Execute EXE file to run command as administrator on restricted user -

i need create file exe when clicked restricted user, execute command administrator (local administrator )

i used code:

system.diagnostics.process.start(@"c:\test.bat", ".\\administrator", password,".\\");

is there way run command like:

netsh int ip set address "local area connection" static 192.168.1.16 255.255.255.0 192.168.1.1 1

without using batch file?

also have problem same code when utilize .msi files. doesn't work

system.diagnostics.process.start(@"c:\test.msi", ".\\administrator", password,".\\");

any way execute msi files administrator?

find exe under hkey_classes_root , add together shell extension registry.

windows registry editor version 5.00

[hkey_classes_root\*\shell\forcerunasinvoker] @="run without admin rights (uac)"

[hkey_classes_root\*\shell\forcerunasinvoker\command] @="cmd /min /c \"set __compat_layer=runasinvoker && start \"\" \"%1\"\""

hopefully find useful

c#

No comments:

Post a Comment