Script to send multiple license expiry notification in Software License/Agreement

Script to send multiple license expiry notification in Software License/Agreement

We can set only 1 notification for the license expiry. Using custom schedule multiple expiry notifications like 90 days before, 60 days before and 30 days before can be achieved using script. 

Prerequisites:
1. Python is a third party software that has to be installed on the server in which MSP is installed. Here is the link for Installation Steps,
2. functions.py:  This package consists of all the functions that are used to handle the standard requirements of the customer.  Most repeated requirements are written as separate functions.  Depending on our use case, we can include these functions in our script. 
3. configuration.json: This file maintains the configuration details of the installed server.  


Execution steps:    
‚Äč
1.  Execute the below query and save the report with a title.

SELECT  resource.RESOURCENAME "licensename",MAX(SoftwareList.SOFTWARENAME) "software_name",MAX(resource.EXPIRYDATE) "expirydate" FROM SoftwareInfo 
LEFT JOIN SoftwareList ON SoftwareInfo.SOFTWAREID=SoftwareList.SOFTWAREID 
LEFT JOIN ComponentDefinitionSoftware ON SoftwareList.SOFTWAREID=ComponentDefinitionSoftware.SOFTWAREID 
LEFT JOIN Resources resource ON ComponentDefinitionSoftware.COMPONENTID=Resource.COMPONENTID where resource.EXPIRYDATE != '0'
 GROUP BY resource.RESOURCENAME 

2.  Extract the ZIP file under ..\ManageEngine\ServiceDeskPlus-MSP\integration\custom_scripts - folder.
3.  Edit the configuration.json and update the values.
4. Modify the email id in the script. Refer to the attached screenshot. 
5.  Configure a custom schedule to execute every day and pass the report saved as a parameter.
6.  Go to Admin > Custom Schedule > give a schedule name > execute script > py send_licensereminder.py






Here the script will send reminder notification before 90,60 and 30 days respectively. If you want you can customize the days in the send_licensereminder_mail file.