How do I run .net code when a user unlocks their machine?
Windows versions: XP and 7
This article looks perfect for you if you want to subscribe to the session lock/unlock events (e.g. how Messenger sets your status to away when you lock your PC).
http://blogs.msdn.com/b/shawnfa/archive/2005/05/17/418891.aspx
Alternatively, you can run a script on Windows 7 unlock as per this ServerFault question: https://serverfault.com/questions/148258/run-a-script-after-i-unlock-my-windows-session