I have this script configured to run after each KES install, it helps in herding the failed KES installs, also eliminates using FTP to get the install log file.
Script Name: KES - Post Install Check Script Description: KES post install will grab the AVG install log file and upload to the K server. AVGInstall.log found in documents directory of agent. If AVG install log not found it will create an event in the Windows Event log. Must have event log monitoring to get alarm when install fails. By: Charles Surrett Convergence Networks IF Test File Parameter 1 : #vAgentConfiguration.agentTempDir#\kes\AVGINSTALL.LOG Exists : THEN Get File Parameter 1 : #vAgentConfiguration.agentTempDir#\kes\AVGINSTALL.LOG Parameter 2 : ..\Docs\KES\AVGInstall.log Parameter 3 : 1 OS Type : 0 ELSE Write Script Log Entry Parameter 1 : KES install log not found. Please check install source and credential. OS Type : 0 Get Variable Parameter 1 : 2 Parameter 2 : error_description Parameter 3 : AVG Install Failed, Please check install source and credential and reinstall. OS Type : 0 Execute Script Parameter 1 : Create Kaseya Event Log Entry (NOTE: Script reference is NOT imported. Correct manually in script editor. Parameter 2 : Parameter 3 : 0 OS Type : 0
Script Name: Create Kaseya Event Log Entry Script Description: This script can be called from any other script to create an error in the Event Log. Simply set the error_description variable in the parent script and then call this script the entry will be added. To pick up these errors make sure the Kaseya Events filter is added to machines in the Kaseya Alerts->Event Log section of monitoring. Uses the windows command line Eventcreate. Note this command line will only create events up to ID 1000. eventcreate /L application /T ERROR /SO Kaseya_Agent /ID 572 /D "Kaseya Reporting an Event" IF True THEN Get Variable Parameter 1 : 2 Parameter 2 : Application Parameter 3 : log OS Type : 13 Get Variable Parameter 1 : 2 Parameter 2 : ERROR Parameter 3 : category OS Type : 13 Get Variable Parameter 1 : 2 Parameter 2 : Kaseya_Agent Parameter 3 : source OS Type : 13 Get Variable Parameter 1 : 2 Parameter 2 : 572 Parameter 3 : ID OS Type : 13 Get Variable Parameter 1 : 2 Parameter 2 : This step is disabled as this variable will be passed from the calling script Parameter 3 : error_description OS Type : -1 Execute Shell Command Parameter 1 : eventcreate /L #log# /T #category# /SO #source# /ID #ID# /D "#error_description#" Parameter 2 : 1 OS Type : 13 ELSE
<?xml version="1.0" encoding="ISO-8859-1" ?> <event_sets> <set_elements setName="APP - Kaseya_Agent_Events" eventSetId="85787199"> <element_data ignore="0" source="Kaseya_Agent" category="*" eventId="572" username="*" description="*"/> </set_elements> </event_sets>