Particularly in environments with large numbers of users and devices, it’s not always an easy task to maintain a full overview. You can arrange to receive a notification email to inform you which devices have not connected with the Cortado server for an extended period. Simply specify a period of inactivity (30 days, for example) and a time at which you would like to receive an email (once a month, for example).
Aim
This How-To deals with creating a script that will help you to keep an overview of inactive user devices.
Implementation
To receive notifications about expiring certificates, you go to PowerShell. With the Task Scheduler from Windows Server, a recurring task is set up to automatically send an email once a month if devices have been found in the database that have not logged on to the Cortado server for at least two weeks.
Configuring the PowerShell script
- Download the following script.
- Open the script and, if necessary, adjust it to your preferred inactivity period. By default, we pick up devices that have not reported back for 30 days (-30) (arrow in illus.).
- Edit the settings you need for your mail server at the end of the script (arrow in illus.).
- You can also make further adjustments to the email template. For example, email text can be edited.
The script is now ready to use. Now place the script in an appropriate folder on your server.
Configuring the Task Scheduler
- Log on to the server on which you want to set up the email notification and start the Task Scheduler there. Click on Create Task, to create a new task (arrow in illus.).
- Configure the Generaltab of the Task Scheduler (as shown in the illus.):
- Enter a name and a description.
- Select Run whether user is logged on or not (lower arrow in illus.).
- Go to the Triggers tab and click on New.
- If needed, change the drop down menu from Begin the task to On a schedule (upper arrow in illus.).
- Under Settings, select Monthly for example (lower arrow in illus.) and enter settings for Start, Month, Days etc.
- Now go to the Actions tab and click on New to create a new action.
- Configure the filter as shown in the illus.:
- Under Program/script, enter the program with which the script is to be opened (powershell.exe) (upper arrow in illus.).
- In Add arguments (optional) enter the path to the script file Ccinactwarn.ps1 and the Powershell command -ExecutionPolicy Bypass:
- < Path to PS Script > -ExecutionPolicy Bypass (lower arrow in illus.).
- Click OK to confirm the settings.
Summary
After these steps have been completed, the script is ready to be used and, once a month, you will be informed by email about inactive devices.