How to run a VB6 app from a scheduled task without users being able to run it

0

We have a legacy VB6 application that automatically emails reports. It runs from a scheduled task on a server. Occasionally a user will run the exe - it's in a folder that we can't lock them out of, and it has to remain in that folder for reasons too complicated to go into here. Is there a way to prevent users from running the exe while still letting it run from the scheduled task? I can modify the source code for the exe, so that's an option if someone can help me figure out how. Or if there's a way to set permissions on the exe so only the Task Scheduler (or our team of 3 developers) can run it, that would work too.

JeffK627

Posted 2017-08-11T18:38:21.980

Reputation: 9

Answers

0

There are two options here.

Modifying the sourcecode

Modifying the sourcecode is possible. All you need to do is making sure the program requires a parameter. If its not present, nothing happens. A user will doubleclick the exe, which does not submit a parameter. You can even make a popup stating: This program should be scheduled, or something.

This can be done using GetCommandlineArgs.

The downside of this, is that if for some reason anyone forgets the secret commandline argument, at some point people may stop using it (for example if you leave the company, IT is done by a different company, etc)

Setting specific access permissions on the .exe file

Another option is to simply set permissions on the .exe file. You can make it so that only administrators can open the file, or deny the rest. Deny takes precedence over allow permissions, so it is possible you are also denying your administrative access. In addition, a user with sufficient knowledge and rights can undo this, then launch the executable. Also, if they copy the executable locally, they may remove the rights and then launch the program.

LPChip

Posted 2017-08-11T18:38:21.980

Reputation: 42 190