Lock and Load

Lock and Load is an application that allows you to listen to various windows events, and execute an arbitrary number of commands as a response.

Lock and Load is written using C# and requires the .NET 3.5 framework.

Upon execution Lock and Load immediately goes to the Notification Area (aka System Tray) where it remains waiting to respond to any configured events.

Download

Lock and Load - Version 1.1

Configuration

Upon first execution an empty configuration item will be placed in your Application Folder (this depends upon the version of windows being used), in a sub folder named “notunusual\LockAndLoad”.

The configuration looks like the following –

<ConfigurationManager
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <ExecuteItemsArray>
             <Executable
                 FileName="C:\Path\To\My\App.exe"
                 Arguments=""
                 Trigger="SessionLock"
                 UseShellExecute="false"
                 WaitToFinish="false"
                 CreateWindow="false" />

    </ExecuteItemsArray>
</ConfigurationManager>

You can provide any number of Executable elements that re-act to any of the trigger events.

Executable Attributes

Attribtue Description
FileName String – The full path to the application to execute
Arguments String – Any arguments to pass to the executable, this can contain any of the special paramaters
UseShellExecute Can be true or false – Indicates whether to use the operating system shell to start the process.
WaitToFinish Can be true or false – Should Lock and Load wait until the executable is finished before moving on to the next executable?
CreateWindow Can be true or false – Indicates whether to start the process in a new window
Trigger See Triggerable Events Table

Triggerable Events Table

Name Description
ConsoleConnect A session has been connected from the console.
ConsoleDisconnect A session has been disconnected from the console.
RemoteConnect A session has been connected from a remote connection.
RemoteDisconnect A session has been disconnected from a remote connection.
SessionLogon A user has logged on to a session.
SessionLogoff A user has logged off from a session.
SessionLock A session has been locked.
SessionUnlock A session has been unlocked.
SessionRemoteControl A session has changed its status to or from remote controlled mode.

Special Parameters Table

Name Description
%trigger% This is replaced with the trigger name which initiatied this event, the values passed match the Trigger names
%user% This is replaced with the currently active windows user
%date% This is replaced with the current date and time with “Short Date/Long Time”, equivalent to passing ‘G’ as the date time format specifier
%date-X% This is replaced with the current date and time in a format specifed with X. The possible values for X are described in the MSDN Standard Date and Time Format Strings page.

5 thoughts on “Lock and Load

  1. How would we pull the logged in user’s username into the arguements? For instance, we might want to pass the username to a URL via CURL.

    thanks

    • At this point there’s no way to do that, I’ll begin to look into setting up some variables that could be used.

      In the mean time, you could always have it call a shell script, or another executable, which would then be able to access what you need, and then make that call curl with your variables.

    • Version 1.1 now has this ability to log the username, what triggered the lock and the date/time stamp of the event, hopefully this works for you.

  2. Would it be possible to get an option / commandline switch to suppress the notification area icon? I’m deploying this preconfigured under VMware ThinApp, and would like to restrict my users ability to interact with it.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>