Kaseya Community

Kaseya Managed Variables

  • I love these vars, I just wish they were easier to get to. Every time I need one of these vars it's long trip into kaseya help, cutting and pasting. I finally broke down and put most of the vars into a sheet. Why didn't I think of making this matrix years ago? 

    Global Variable Type Purpose
    #vMachine.agentGuid# numeric A globally unique identifier for a machine ID.group ID account and its corresponding agent.
    #vMachine.BusSpeed# varchar External Bus Speed (in MHz) (type 4)
    #vMachine.ChassisAssetTag# varchar Chassis Asset Tag number (type 3)
    #vMachine.ChassisManufacturer# varchar Chassis Manufacturer (type 3)
    #vMachine.ChassisSerialNum# varchar Chassis Serial Number (type 3)
    #vMachine.ChassisType# varchar Chassis Type (type 3)
    #vMachine.ChassisVersion# varchar Chassis Ver (type 3)
    #vMachine.ComputerName# varchar Name of the Computer
    #vMachine.ConnectionGatewayIp# varchar IP Address in a.b.c.d notation obtained by the Kserver as the source address of the Agent.  This IP is the Agents network gateway and will be different from the IpAddress if the computer is behind NAT for example.  String is empty if unavailable.
    #vMachine.DefaultGateway# varchar Default gateway IP address in a.b.c.d notation.  String is empty if data is unavailable.
    #vMachine.DhcpEnable# int 0 -> Data is unavailable
    #vMachine.DhcpServer# varchar DHCP servers IP address in a.b.c.d notation.  String is empty if data is unavailable.
    #vMachine.DnsServer1# varchar DNS server #1s IP address in a.b.c.d notation.  String is empty if data is unavailable.
    #vMachine.DnsServer2# varchar DNS server #2s IP address in a.b.c.d notation.  String is empty if data is unavailable.
    #vMachine.DnsServer3# varchar DNS server #3s IP address in a.b.c.d notation.  String is empty if data is unavailable.
    #vMachine.DnsServer4# varchar DNS server #4s IP address in a.b.c.d notation.  String is empty if data is unavailable.
    #vMachine.groupName# varchar full group name for this account. Everything to the right of the left most decimal point is the group name.
    #vMachine.IpAddress# varchar IP Address of the computer in a.b.c.d notation
    #vMachine.LoginName# varchar User name of the currently logged on user.  This value is updated with every quick check in.  The agent error log file is updated with each change.
    #vMachine.MacAddr# varchar String containing the physical address, i.e. the Media Access Control address, of the connection.  A MAC address has the form of: 00-03- 47-12-65-77
    #vMachine.Machine_GroupID# varchar A concatenated representation of the machine id and the group id it is associated with.
    #vMachine.MachineVersion# varchar Version string (type 1)
    #vMachine.machName# varchar full machine name. Everything to the left of the left most decimal point is the machine name.
    #vMachine.MajorVersion# int Major version number from GetVersionEx() Windows function call.
    #vMachine.Manufacturer# varchar Manufacturer string (type 1)
    #vMachine.MaxMemorySize# varchar Maximum Memory Module Size (in MB) (type 16 - Maximum Capacity or if type 16 not available, Maximum Memory Module Size type 5)
    #vMachine.MaxMemorySlots# varchar Number of Associated Memory Slots (Number of Memory Devices in type 16 or if type 16 not available Number of Associated Memory Slots in type 5)
    #vMachine.MinorVersion# int Minor version number from GetVersionEx() Windows function call.If PlatformId is Win32 for Windows, then a 0 MinorVersion indicates Windows 95.  If PlatformId is Win32 for Windows, then then a MinorVersion > 0 indicates Windows 98.
    #vMachine.MotherboardManfacturer# varchar Motherboard Manufacturer (type 2)
    #vMachine.MotherboardProductCode# varchar Motherboard Product Code (type 2)
    #vMachine.MotherboardSerialNumber# varchar Motherboard Serial Number (type 2)
    #vMachine.MotherboardVersion# varchar Motherboard Version (type 2)
    #vMachine.OsInfo# varchar String contains additional OS info, such as Build 1381 Service Pack 3.  Derived from portions of BuildNumber and CsdVersion.
    #vMachine.OsType# varchar String contains OS type, such as 95, 98, NT4, 2000, NT3.51, or WIN32s.  Derived from portions of MajorVersion, MinorVersion, and PlatformId.
    #vMachine.PrimaryWinsServer# varchar Primary WINS servers IP address in a.b.c.d notation.  String is empty if unavailable.
    #vMachine.ProductName# varchar Product Name string (type 1)
    #vMachine.SecondaryWinsServer# varchar Secondary WINS servers IP address in a.b.c.d notation.  String is empty if unavailable.
    #vMachine.SubnetMask# varchar Subnet mask in a.b.c.d notation.  String is empty if data is unavailable
    #vMachine.SysSerialNumber# varchar Serial Number string (type 1)
    #vMachine.WinsEnabled# int 0 -> Data is unavailable | 1 -> DHCP on client computer is enabled | 2 -> Disabled | 1 -> WINS resolution on client computer is enabled
    #vSystemInfo.Machine_GroupID# varchar A concatenated representation of the machine id and the group id it is associated with.
    #vSystemInfo.machName# varchar Machine Name used for each agent
    #vSystemInfo.groupName# varchar Group Name used for each agent
    #vSystemInfo.Manufacturer# varchar System manufacturer string
    #vSystemInfo.Product Name# varchar Name or model number of the machine supplied by the manufacturer
    #vSystemInfo.System Version# varchar Machine version string
    #vSystemInfo.System Serial Number# varchar Machine serial number string entered by the manufacturer
    #vSystemInfo.Chassis Serial Number# varchar Serial number string supplied by the manufacturer
    #vSystemInfo.Chassis Asset Tag# varchar Asset tag string supplied by the manufacturer
    #vSystemInfo.External Bus Speed# varchar Motherboard bus speed
    #vSystemInfo.Max Memory Size# varchar Max memory this system may be configured with
    #vSystemInfo.Max Memory Slots# varchar Max number of memory slots this system has
    #vSystemInfo.Chassis Manufacturer# varchar Name of manufacturer of the chassis
    #vSystemInfo.Chassis Type# varchar system chassis type
    #vSystemInfo.Chassis Version# varchar version string of the chassis
    #vSystemInfo.Motherboard Manufacturer# varchar Name of motherboard manufacturer
    #vSystemInfo.Motherboard Product# varchar Motherboard model name
    #vSystemInfo.Processor Family# varchar processor family name
    #vSystemInfo.Processor Manufacturer# varchar processor manufacturer name
    #vSystemInfo.Processor Version# varchar processor version string
    #vSystemInfo.CPU Max Speed# varchar max speed of this processor
    #vSystemInfo.CPU Current Speed# varchar configured speed of this processor
    #vAgentConfiguration.Machine_GroupID# varchar A concatenated representation of the machine id and the group id it is associated with.
    #vAgentConfiguration.agentGuid# numeric A globally unique identifier for a machine ID.group ID account and its corresponding agent.
    #vAgentConfiguration.machName# varchar Machine Name used for each agent
    #vAgentConfiguration.groupName# varchar Group Name used for each agent
    #vAgentConfiguration.firstCheckin# datetime timestamp recording the first time this agent checked into the system
    #vAgentConfiguration.lastCheckin# datetime timestamp recording the most recent time this agent checked into the system
    #vAgentConfiguration.currentUser# varchar login name of the currently logged in user. Blank if no one logged in at this time
    #vAgentConfiguration.lastLoginName# varchar login name of the last user to log into this system
    #vAgentConfiguration.workgroupDomainType# tinyint 0 (or Null) = unknown 1 = not joined to either 2 = member of workgroup 3 = member of domain 4 = domain controller
    #vAgentConfiguration.workgroupDomainName# nvarchar The name of the workgroup or domain
    #vAgentConfiguration.lastReboot# datetime timestamp when this system was last rebooted
    #vAgentConfiguration.agentVersion# int version number of agent installed on this system
    #vAgentConfiguration.contactName# varchar User contact name assigned to this agent
    #vAgentConfiguration.contactEmail# varchar User email address assigned to this agent
    #vAgentConfiguration.contactPhone# varchar Contact phone number assigned to this agent
    #vAgentConfiguration.contactNotes# varchar Notes associated with the contact information for this agent
    #vAgentConfiguration.enableTickets# int 0 if this user does not have access to ticketing through the user interface
    #vAgentConfiguration.enableRemoteControl# int 0 if this user does not have access to remote control through the user interface
    #vAgentConfiguration.enableChat# int 0 if this user does not have access to chat through the user interface
    #vAgentConfiguration.loginName# varchar Login Name assigned to this user (if any) to access the system user portal interface.
    #vAgentConfiguration.credentialName# varchar The username of the credential set for this agent (if any)
    #vAgentConfiguration.primaryKServer# varchar address:port agent connects to for its primary kserver connection
    #vAgentConfiguration.secondaryKServer# varchar address:port agent connects to for its secondary kserver connection
    #vAgentConfiguration.quickCheckinSecs# int interval in seconds between quick checkins
    #vAgentConfiguration.agentTempDir# varchar The temp directory used by the agent on this system
    #vCurrCpuInfo.Machine_GroupID# varchar A concatenated representation of the machine id and the group id it is associated with.
    #vCurrCpuInfo.agentGuid# numeric A globally unique identifier for a machine ID.group ID account and its corresponding agent.
    #vCurrCpuInfo.machName# varchar Machine Name used for each agent
    #vCurrCpuInfo.groupName# varchar Group Name used for each agent
    #vCurrCpuInfo.CpuDesc# varchar CPU description (e.g. Pentium III Model 8)
    #vCurrCpuInfo.CpuSpeed# int CPU speed in MHz (e.g. 601)
    #vCurrCpuInfo.CpuCount# int Number of processors (e.g. 1)
    #vCurrCpuInfo.TotalRam# int Amount of RAM in MBytes (e.g. 250)
  • Wait! You didn't create these years ago??  You created them today and didn't post in Excel ? ? ? How will I ever filter these? :D

    Seriously - THANKS! this will help a lot of folks out there. They aren't the easiest things to find when you need them!

    Glenn

    PS - the ONE variable I always look for and realize doesn't exist is the ORG name.



    ps
    [edited by: gbarnas at 6:54 PM (GMT -7) on Oct 24, 2018]
  • Amazing! Great work man. I also should have thought to do this a long time ago. Every time I need one of these it takes ages going through disparate help documents with no joined up documentation, and it's always when I need them quickly I need to spend ages going through those *** help files!



    Typo
    [edited by: JB1975 at 12:11 AM (GMT -7) on Oct 25, 2018]
  • I always just google: kaseya database view > all those var you can use :)

  • #adminDefaults.adminEmail# is another I use often.   Returns the current VSA users email, I use it in some scripts that will email the tech with the results of the task :)

  • - I was also surprised the org name isn't available. We came up with a horrible agent procedure to get it, works on Windows only but could be extended easily enough. The gist of it is to extract it from #vAgentName.groupName# which lists the org name 'first'.

    for /F "tokens=1 delims=." %i in ("#vAgentName.groupName#") do echo %i>>#vAgentConfiguration.AgentTempDir#\organisation.txt

  • It does.. just need to strip it out from the variable for groupname

    e.g. #vMachine.groupName#  gives you Organization, then machine group the machine is assigned to

    So anything up to the 1st '.' is the Org

  • Actually .. I take that back .. groupname is in the opposite order with ORG on the End .. so not quite as simple

  • OK .. so bit obscure by #vPatchStatusByAgent/GroupName#  will give you ORG.Group ( it the reverse to all the other views)

    So now as per my 1st post everything up to the 1st '.' is the ORG

    Create a SQLQuery using the following

    select left(#vPatchStatusByAgent/GroupName#,charindex('.',#vPatchStatusByAgent/GroupName#)) charindex(groupname,'.'))

    And save the result to a variable

    It will return JUST the Org name

    Paul

  • - #vAgentName.groupName# also has the name in reverse format.

    How do we execute custom SQL queries within agent procedures? I thought this was kind of deprecated?

  • For On-Prem only , you create an XML file that defines the SQL query , save it to your VSA in the XML folder , then it will appear as an available option using the SQLRead step

    So the XML file would look like this :

    <?xml version="1.0" encoding="utf-8" ?>

    <queryList>

    <queryDef label="Get_OrgName" sql="select left(#vPatchStatusByAgent/GroupName#,charindex('.',#vPatchStatusByAgent/GroupName#)) charindex(groupname,'.'))" />

    </queryList>

    Save it to your VSA with an .xml file extension to :

    C:\kaseya\XML\Procedures\AgentProcSQL\0\SQLRead

    Then use the SQLRead Step in your Agent procedure and the query will show as "Get_OrgName" .. ie the Label it was given in the XML file

    Paul

  • Not to take anything away from Paul's solution, but since it requires a SQL query, it won't work in SAAS. (technically, it could, but I'm still waiting for Kaseya to approve the SQL query THEY GAVE TO ME to be approved in SAAS - 9 months and counting without approval! :(

    We have an app to get this done so it works in SAAS, but the real issue is that something THIS FUNDAMENTAL shouldn't have to be obtained with workarounds of any kind.

    Glenn