At work I need to fill in my office hours into a website. Sometimes I forget. By running a python script on login and logoff my office hours are written to a txt file.
- Clone this project to any folder.
- Run gpedit.msc
- User Configuration > Windows Settings > Scripts (Logon/Logoff)
- Logon, Properties, Scripts, Add...
- Choose logon.bat in repository folder
- Do the same for logoff but choose logoff.bat
For every logon and logoff, an entry is added to office_hours.txt (created in the same folder as the Python script)
Example from office_hours.txt:
IN 2016-02-19 08:13:12
OUT 2016-02-19 17:17:53
IN 2016-02-20 09:01:05
OUT 2016-02-20 16:31:56
Windows 8.1 has 5 minutes logon scripts delay. That's not critical for our case but for exact statistics we need to change this.
- Run gpedit.msc
- Open Configure Group Policy
- Computer Configuration > Administrative Templates > System > Group Policy > Configure Logon Script Delay
- Set
Disabled