Kaseya Community

User usage reporting

  • Anyone know if it's possible to pull a list of Agent procedures that have been used and by who?


    When I looked through the report parts I don't see any way to get at this information.

  • Hi Daniel,

    The best I have come up with this so far, and I have even checked the legacy reporting without any luck, is as follows;

    From the report parts I used Agent Procedure Status data set as it has the minimum required fields "Action Admins" and "Script Name" for this report.


    I then created the report part using that dataset and defined the report part Name, description and added the "Script Name" and "agentGuid" fields renaming them and setting the "agentGuid" aggregate to Count as I was unable to find a way to count the number of times the procedure was executed in this format and at least you can tell against how many agent the procedure was executed;

    Next I defined the Order and Group By values, I orders by "Script Name" and Grouped by "Action Admins";


    The next step and harder part is the filtering;

    I filter both the "Action Admin" and "Script Name" to exclude "Empty" and "Null" values and then I define the following exclusions to refine the report further;

    Action Admin: 
    kDefault,Monitor,System

    Script Name:
    -000,Unzip File,Copy file,Delete File,Delete Folder,Windows - 32 or 64 bit OS,WUA Patch,WR_Registry_Status,K Agent Update,Patch Scan,Patch Post,Execute Powershell Command,Execute Shell command,Execute Patch Scan,Opt-in for Microsoft Update,VarTest,Write text to file,Start Windows Service,Stop Windows Service,VNC,WinVNC

    If this report does not have the information you need the only option is to create a new Data Set, which can only be done with On-Prem servers this can be done from the "Name Value Parts" and requires more intimate knowledge of the ksubscribers database;

    Hope this helps.



    typo
    [edited by: HardKnoX at 9:17 PM (GMT -7) on May 11, 2020]
  • Hello Daniel,

    If you are on Premise, I have a small script that I use for me. Without any warranty it will work for you :-)

    I like to see the full path from where the scripts were executed and I want to see only the last time it was executed (for each agent).

    In my case it works for Kaseya Procedures only, I also excluded the sample procedures.

    You can run it on SSMS or it is quite easy to plop this into an SSRS report and even put some filters if you like.

    Alex

    Here it goes:

    WITH procFolders

    AS (

    select (Case T1.treeNodeTypeFK when 1 then 'Private' else 'Shared' end) Lvl, T1.id, T1.PartitionID, T1.treePresFK, T1.parentId, T1.treeNodeTypeFK, T1.treeNodeObjectFK, T1.ref, T1.treeDesc, T1.treeFullPath, T1.sortOrder, T1.securityOverride

    from [Tree].treeNode T1 where T1.treeNodeObjectFK is null and ((T1.treePresFK = 3 and T1.treeNodeTypeFK = 3) or (T1.treePresFK = 3 and T1.treeNodeTypeFK = 1))

       UNION ALL

       select p.Lvl, T2.id, T2.PartitionID, T2.treePresFK, T2.parentId, T2.treeNodeTypeFK, T2.treeNodeObjectFK, T2.ref, T2.treeDesc, T2.treeFullPath, T2.sortOrder, T2.securityOverride

    from [Tree].treeNode T2

       INNER JOIN procFolders p

           ON p.PartitionID = T2.partitionID and T2.parentID = p.ID and T2.treeFullPath not like 'Sample%' and T2.treeFullPath not like 'Recovered%'

    )

    SELECT procFolders.lvl, procFolders.treeFullPath, procFolders.ref ObjectName, COALESCE(TC1.ref, 'Script'), ps.displayName, ps.scriptName, ps.LastExecTime, ps.LastExecStatus, ps.ActionAdmin

    FROM procFolders

    left outer join [Tree].TreeNodeConfig TC1 ON procFolders.treeNodeTypeFK = TC1.id

    left outer join (select ROW_NUMBER() OVER(PARTITION BY vps.AgentGuid, st.scriptID ORDER BY vps.AgentGuid, vps.lastexecstatus DESC) AS ROWNUM, vps.*, st.rootScriptId from [dbo].[vAgentProcedureStatus] vps, [dbo].[scriptIdTab] st where vps.scriptID = st.scriptID) ps

    ON ps.ScriptID = procFolders.treeNodeObjectFK and TC1.id is null and ROWNUM = 1

    order by treeFullPath