shrum.net :: Code :: Execute

|
Execute
|
| A utility for issuing commands
enmass to a group of
networked computers. Great for computer labs and small business
with multiple systems. |
| |
Execute is a systray app that monitors a file for commands to execute.
When the timestamp on the monitored TXT file of the same name changes, execute reads the file and
runs the command(s) in the file.
The point of this tool is to allow administrators on networked systems to
broadcast and execute commands to multiple PC's; such as
in a computer lab environment; by editing 1 monitored file. This can also be
used to force close applications as well using apps geared toward that result. Primary use will be
for mass shutdowns and logoffs (here's
a great page with most, if not all, native NT/XP commands). On the evil
flipside (in my case), I wrote this gem to punk an unsuspecting jokester
coworker (hehe, I'm using the
XP shutdown
commands as well as launching applications that will seem like random).
I wrote this program while I was setting up computer labs for a private
elementary schools. The computer lab teachers wanted a way to reset all the PC's in
the lab between classes quickly as well as being able to pre-stage programs for
incoming classes.
The program launches automatically via the HKLM\software\microsoft\windows\currentversion\run
key pointing to the executable in a shared READ-ONLY location on the teachers
computer.
In the same location as the executable is a txt file of the same filename....execute.txt.
Best to think of it like a batch file. Commands placed here will be read by the
execute program on the workstations and will trigger the actions. I then
pre-created files that would allow the computer lab teacher to do
things like close all apps (via my killapps
project), launch various apps like Word, Paint, Excel, etc, and
shutdown all the systems from
the computer lab teacher PC.
Download and store the program on a system in a read-only shared folder of
the main PC in your lab / workplace. Run the app from the client
workstation which will set up the program to run on startup from the shared folder.
It will begin
monitoring for execute.txt in the same location as the EXE file itself
(hence the need for a read only folder as this prevents malicious users from
modifying the txt file).
Execute.exe can be run with the following parameters:
- execute.exe
Runs execute with a SysTray icon and writes a reg entry to HKLM run
key
- execute.exe -1
Runs execute in hidden mode (no systray icon) and writes a reg entry
to HKLM run key
- execute.exe -2
Runs execute with a Systray icon and removes the reg entry from HKLM
run key
- execute.exe -3
Runs execute in hidden mode (no systray icon) and removes the reg
entry to HKLM run key
To close the utility, run the program with '-2' or '-3' parameters and reboot
or use the task manager to end the execute.exe process.
To trigger a action, simply create or modify the execute.txt file located in
the same folder as the executable. The running app will see the file
modification timestamp change, triggering a read of the file and will then
execute the commands in the file. The app will then update the monitored
timestamp and wait for the next change.