0

I wrote a program. It kills the process notepad.exe running on computer by and it looks like that: `

Process process = new Process();
process.StartInfo.FileName = "cmd.exe";
process.StartInfo.UseShellExecute = false;
process.StartInfo.WorkingDirectory = @"d:\Windows\System32";
process.StartInfo.Arguments = "/c taskkill /IM notepad.exe";
process.Start();
process.Close();`

I placed this code on my web page. The problem is: when I use the Visual Studio Development server it works. When change to local iis 7.5 it don't. I tried to figure it out, so I even gave the administrator privileges to "DefaultAppPool" or run the whole web page as Administrator (then all the processes as cmd.exe are running as Administrator) but wasn't a solution.

Mateusz
  • 11
  • 4
  • have you tried specifying username and password on the startinfo? I would have used pskill.exe but your taskkill might be just as good. – Snorre Dec 16 '13 at 07:16
  • Its better to make notepad.exe close by him self when you use it, even better is to not run the notepad.exe, find some other way to design your automations. – Aristos Dec 16 '13 at 07:17
  • Have you tried going into Services, and doubleclick World Wide Web Publishing Service, then go to Log On and select Allow Interaction with Desktop? – Snorre Dec 16 '13 at 07:22
  • In fact I'm not killing the notepad.exe. I wrote this only for example purpose but It's good analogy to my problem. I also specified username and password on startinfo but it didn't worked. – Mateusz Dec 16 '13 at 07:27
  • It's not so simple to find Log On in iis 7.5. If you know how to do it I will be indebted. – Mateusz Dec 16 '13 at 07:30
  • its not on iis. windows services. click Run->services.msc – Snorre Dec 16 '13 at 07:35
  • Ok I got it. But it still is not working. – Mateusz Dec 16 '13 at 07:41
  • does adding /f to the arguments help? taskkill /F /IM notepad.exe – SmithMart Dec 16 '13 at 08:33
  • SmithMart. YOU ARE GENIOUS!!! Thx a lot! – Mateusz Dec 16 '13 at 08:47

0 Answers0