--This function is called by KNM when enumerating a field
function OnEnumerate(sFieldToEnum)
Enum = LuaScriptEnumResult()
if sFieldToEnum == "Ignore connection problems" then
Enum:Add("Yes")
Enum:Add("No")
end
return Enum
end
--This function is called by KNM to retrieve a script configuration
function OnConfigure()
Config = LuaScriptConfigurator()
Config:SetAuthor("Robert Aronsson, Kaseya AB")
Config:SetDescription("The script check if a certificate is about to
expire within the configured number of days.")
Config:SetMinBuildVersion(5280)
Config:SetScriptVersion(1,0)
Config:AddArgument("Port number","Port number to connect on", LuaScriptConfigurator.CHECK_NOT_EMPTY)
Config:AddArgument("Number of days","Check if certificate expres within this period",LuaScriptConfigurator.CHECK_NOT_EMPTY)
Config:AddArgument("Ignore connection problems","Do you want thescript to report connection problems as well ?",LuaScriptConfigurator.ENUM_AVAIL + LuaScriptConfigurator.CHECK_NOT_EMPTY)
Config:SetEntryPoint("main")
return Config
end
--This is the entry point
function main()
local iPort = GetArgument(0)
local iNumDays = GetArgument(1)
local bReportConnectionProblem = false;
if GetArgument(2) == "Yes" then
bReportConnectionProblem = true
end
--Timeperiod that the certificate should be valid within