Kaseya Community

File Size in GB

  • Hi,

    I am trying to update file size under a custom field, in *GB notation ((Decimal) ( Ex: 2 GB/2.5 GB/ 0.3 GB)). But i am getting an output size as 732658926. 

    Please find the attached example procedure image for your reference.

    Thanks in advance..



  • DB_Size.png

    Attaching my procedure.

  • Hello Sumanth,

    Here is an example you can use to get File Size converted into GB. I used a multiplication to ensure there's no division by 0 error in case of 0 bytes file size.

    It is "rounded" but should be fine. Otherwise change Expression Value with a full division as needed.

    The calculations is based on:
    1 kilobyte (K / Kb) = 2^10 bytes = 1,024 bytes. 1 megabyte (M / MB) = 2^20 bytes = 1,048,576 bytes. 1 gigabyte (G / GB) = 2^30 bytes = 1,073,741,824 bytes. 1 terabyte (T / TB) = 2^40 bytes = 1,099,511,627,776 bytes.
    Remember: don't add # to the Variable Names when you create them (only when you use them).

    <Procedure name="Test2" treePres="3" id="2094652513" folderId="477685157804603" treeFullPath="myProcedures - alessandrodimarco">
    <Body description="">
    <Statement name="GetVariable" continueOnFail="false">
    <Parameter xsi:type="EnumParameter" name="VariableType" value="FileSize"/>
    <Parameter xsi:type="StringParameter" name="SourceContent" value="#vAgentConfiguration.AgentTempDir#\Klicense.exe"/>
    <Parameter xsi:type="StringParameter" name="VariableName" value="FSize"/>
    <Statement name="GetVariable" continueOnFail="false">
    <Parameter xsi:type="EnumParameter" name="VariableType" value="ExpressionValue"/>
    <Parameter xsi:type="StringParameter" name="SourceContent" value="(#FSize# * 0.00000000093 )"/>
    <Parameter xsi:type="StringParameter" name="VariableName" value="FSizeGb"/>
    <Statement name="SendMessage" continueOnFail="false">
    <Parameter xsi:type="StringParameter" name="Message" value="#FSizeGb#"/>
    <Parameter xsi:type="BooleanParameter" name="Immediate" value="False"/>

    The editor did not save the image that had the procedure.
    [edited by: Alessandro Di Marco at 12:34 AM (GMT -7) on Mar 9, 2020]
    [edited by: Alessandro Di Marco at 12:36 AM (GMT -7) on Mar 9, 2020]
  • 2020-03-09 11_28_22-Edit Procedure - Test2.png

    Somehow the editor did not save the image I pasted...

  • Marco,

    Thanks for your that..

    Can you please post above xml as procedure. As i am unable to import the given xml procedure.

    Getting the error like "The text you are trying to import is not a valid XML import format."

    Thanks & regards,


  • Thanks Marco it's working like a spark...

  • Hello Sumanth,

    My previous post has a picture that shows each step to do (it is easy to do it from scratch manually as it is only 3 steps).

    The key is to use a GetVariable using Evaluation Formula and put your expression there to divide bytes and get GB.


  • Thanks Alex for clear explanation...