At first, happy new year 2019 to you all!
I have been thinking what topic would be my first blog post of year 2019, maybe something about ConfigMgr or Intune? Turns out, neither! In these two days, I have been make a idle notification/action tool, because I have some needs log off user from machine if user is not using it for xx minutes, it needs to have popup notifications, custom text, time out features, and most important: Do some actions, example log off the user. Basically this is useful for public use machines or shared PCs, Kiosk PCs.
I found this Idle detection code from Andy Arismendi : https://stackoverflow.com/questions/15845508/get-idle-time-of-machine , it works very well, this helped me maked my own Idle notification tool. This is how it looks like:
How does it work
After installation, it puts SCConfigMgr Idle Notification.lnk shortcut in folder C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp, when user logon, it runs SCConfigMgr Idle Notification.exe in background, it checks idle status every 10 seconds. After installation, you have to log off then log in again, so that SCConfigMgr Idle Notification.exe will automatically start. Based on your configuration, it will popup a custom notification when reach to xx minutes idle time, this notification will stay on your desktop xx minutes unless you click OK. Idle time will be reset to 0 if someone use mouse or keyboard.
What this tool can do and how to configure it
- All the properties are stored in settings.xml file, which can be configured as how you like.
- You will need to put all these three files in one folder, then create a shortcut for SCConfigMgr Idle Notification.exe
- Put the shortcut to C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp folder, so that this app will start automatically when user login.
Here are the configurable properties
Well, title is tile, by default it is SCConfgMgr
You can configure your own image, it supports max. 300 x 80 pixels jpg file. You must copy the file to same installation folder as this tool, configure property IMAGEFILE value to your logo image file name. Default logo image is our SCConfigMgr banner.
Here you can configure idle time in minutes. Default is 5. I have hard coded that check each 10 seconds idle status, so there are some delays.
This is the text saying This computer has not been used for 5 minutes, you will be logged off soon. If you wish to continue use it, please click ‘OK’
NOTE: Please don’t input too much characters, otherwise it will push log off time and OK button out of notification box.
This is how long popup notification will stays on your desktop by minutes. Default is 2.
This is the text saying Log off time, details of log off time is calculated in the app, I made this property just in case you want to change it to your local language.
I was originally only want log off the user, but I didn’t hard coded this one, you can configure other commands. Default is shutdown.exe /l /f, this command will force log off current user.
You can use this configure what time do you want it checks idle time, example if you want starts at 8am, use value 480, calculate 8 time 60 minutes, so it’s 480. Default is 0
You can use PowerShell calculate this value as well, example:
# 8AM (New-TimeSpan -Hours 8).TotalMinutes # 5PM (New-TimeSpan -Hours 17).TotalMinutes
Use this property configure how long do you it checks idle time since StartTime. Example, you want configure it check idle time from 8am to 5pm, configure STARTTIMEMINUTES as 480, DURATIONMINUTES 540. Default is 1440
You can use PowerShell calculate this values as well, example
# from 8AM to 5PM (New-TimeSpan -Hours (17-8)).TotalMinutes # from 10PM to next day 8AM (New-TimeSpan -Hours (24-22+8)).TotalMinutes
Default is False, if set it to True, it will detect locked status, and it will not do anything if user locked the machine. But if user locked the machine after idle notification appears and didn’t choose OK, it will still log off the user.
Default is False. If set it to True, it will detect if PowerPoint SlidesShow is on, it will not anything. However, if user start SlideShow after notification appear and didn’t choose OK, it will still log off the user. Set it to False if you don’t want the dectection
In here you can configure process names, if the process is running, Idle tool will not do any actions. You can add more processes by adding <Name>your process</Name>
You can download this tool from TechNet: Click here
- Version 220.127.116.11 (April.18.2019) Fixed bug that popup windows doesn’t work if there are special characters (Thanks for Maurice’s help)
- Version 2.0.1 (April.03.2019) Fixed a bug that action didn’t run.
- Version 2.0.0 (March.31.2019) Added detect running process. Note, I no longer offer the ready msi package, you will have to pack all the files and deploy them.
- Version 1.0.6 (Jan.25.2019) Fixed a bug that body text property was not applied.
- Version 1.0.5 (Jan.11.2019) Added property DETECTSLIDESHOW. Default is True, if PowerPoint SlidesShow is on, it will not anything. However, if user start SlideShow after notification appear and didn’t choose OK, it will still log off the user. Set it to False if you don’t want the dectection
- Version 1.0.4 (Jan.10.2019) Added Padding in textbox, so that text are not in the edge of textbox
- Version 1.0.3 (Jan.10.2019) Added property DETECTLOCK, Default is True, it will not do anything if user locked the machine. However, if user locked the machine after notification appear and didn’t choose OK, it will still log off the user. Set it to False iif you don’t want the dectection
- Version 1.0.1 (Jan.10.2019) Added two properties, can now use between time frames
- Version 1.0.0 (Jan.07.2019) First version.