Create specified delay before program will open after it was killed using C#

Saxitalis
Saxitalis used Ask the Experts™
on
Hello Experts,

I am remotely killing Internet explorer with the following code in a C# APP:

System.Diagnostics.Process.Start("taskkill", "/S ComputerName /Im iexplore.exe");

This works great...

Now I would like to specify a delay before Internet Explorer can be opened back up after the taskkill (shown above).

In Other words I want to remotely...

1. Close IE browser window on remote computer with code shown above - this works fine
2. Specify a delay, say 30 minutes, before IE can open back up no matter how many times the icon is clicked by user.

Does anyone know how to do this?

Thanks!
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2015

Commented:
It's a very bad idea, because a lot of other programs might not work correctly if Internet Explorer is disabled. A lot is dependant on the browser in todays applications.

This being said, the only way I can think of doing that would be to rename the IE executable file, that is usually "C:\Program Files\Internet Explorer\iexplore.exe".

I am not just sure that an application started by a regular user (non administrator) will have the right to do that, specially since you are in Remote.
Top Expert 2016
Commented:
your iekiller program will have to keep running:

pseudo-code

kill internet explorer
// 30 minutes is 1800 seconds
for (counter=0; counter < 1800; counter ++){
   sleep 1 second
    if (tasklkist /f  iexplore .exe == true) {
// kill iexplorer
System.Diagnostics.Process.Start("taskkill", "/S ComputerName /Im iexplore.exe");
// optional
popup("Internet Explorer is currently disabled")
} // end of iekill 
} // end of delay

Open in new window

Author

Commented:
Thanks

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial