Kaseya Community

Kaseya 9.1 procedure to get 64bit registry value to determine itunes version

  • I have verified that on the agent it self, I can run a command:

    HKEY_LOCAL_MACHINE\SOFTWARE\Apple Computer, Inc.\iTunes" /v Version

    and I receive a reply : HKEY_LOCAL_MACHINE\SOFTWARE\Apple Computer, Inc.\iTunes   Version REG_SZ 12.3.2.35

    So I create a procedure as follows:

    <ScriptExport xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.kaseya.com/vsa/2008/12/Scripting">
    ");"><Procedure name="Get itunes Version" treePres="3" id="1702376806" folderId="776034924376772" treeFullPath="DS Tools.Itunes">
    ");"><Body description="Get Itunes version and store in system info table">
    ");"><If description="">
    ");"><Condition name="TestRegistryKey64">
    <Parameter xsi:type="StringParameter" name="Path" value="HKEY_LOCAL_MACHINE\SOFTWARE\Apple Computer, Inc.\iTunes"/>
    <Parameter xsi:type="EnumParameter" name="Condition" value="Exists"/>
    </Condition>
    </If>
    ");"><If description="">
    <Condition name="True"/>
    ");"><Then>
    ");"><If description="">
    ");"><Condition name="CheckRegistryValue64">
    <Parameter xsi:type="StringParameter" name="RegistryPath" value="HKEY_LOCAL_MACHINE\SOFTWARE\Apple Computer, Inc.\iTunes\Version"/>
    <Parameter xsi:type="EnumParameter" name="Condition" value="Exists"/>
    <Parameter xsi:type="StringParameter" name="Value" value=""/>
    </Condition>
    </If>
    ");"><If description="">
    <Condition name="True"/>
    ");"><Then>
    ");"><Statement name="GetVariable" continueOnFail="false" osType="Windows">
    <Parameter xsi:type="EnumParameter" name="VariableType" value="RegistryValue"/>
    <Parameter xsi:type="StringParameter" name="SourceContent" value="HKEY_LOCAL_MACHINE\SOFTWARE\Apple Computer, Inc.\iTunes\Version"/>
    <Parameter xsi:type="StringParameter" name="VariableName" value="version"/>
    </Statement>
    ");"><Statement name="UpdateSystemInfo" continueOnFail="false" osType="Windows">
    <Parameter xsi:type="StringParameter" name="ColumnName" value="Itunes Version"/>
    <Parameter xsi:type="StringParameter" name="Value" value="#version#"/>
    </Statement>
    </Then>
    </If>
    </Then>
    </If>
    </Body>
    </Procedure>
    </ScriptExport>
    It appears to be failing on step2, line 2, which is actually getting the value. I have tried several adjustments with no success. kindly advise-  Thank you
  • Hello Tiredeli,

    I know this is not exactly fixing your script but how about taking this with a different perspective?

    Instead of hitting the registry directly to get the iTunes Version you could run the following one line PowerShell and do the same.

    try { (new-object -comobject ITunes.Application).Version } catch {}

    This would be resistant to changes (in case Apple decides to store it somewhere else in the registry).

    Your procedure could start with something along those lines:


    You could also have the "version" variable filled with a notification that iTunes is not installed by replacing the command with this:

    try { (new-object -comobject ITunes.Application).Version } catch {Write-host "ITunes Not Installed"}

    Best Regards

  • Hey Thanks for replying. So I tried this, I assume I have to also use my "update system info" command with the variable "version" . I tried it, and also looked in the logs, I dont see the result. What do you think? Am I missing something?

  • Hello Tiredeli,
    Are you sure you have followed the steps completely?
    May be too obvious but try to check the parameter of the ExecutePowershellCommandxxBitUser has the "Return results to variable #global:psresults# set to True.

    And yes you have to use Update System Info to update your custom field (in my example I used the WriteProcedureLogEntry just for debug purposes so you could see if it worked in the Agent Log).

    The real procedure should be as follows:


    And in the UpdateSystemInfo function you would want to choose the correct custom column (I picked up a random column just for example purposes).


    Best Regards

  • ,

    Thanks for sharing these tips with the community.  Just a recommendation:  when using Custom Fields, avoid using spaces.  Underscores or CamelCase are preferred as spaces can add complications when trying to use them in procedures.  That isn't to say that you can't work around it, but omitting spaces is one of those things that can make life down the road just a little bit easier.   mentions this in an older-but-still-relevant post here:  community.kaseya.com/.../65930.aspx

  • Thank You, I re-did the procedure as well as removed the space in the custom field. It works. Thanks!

  • Brande Schweitzer / Tiredeli,

    No problem :-)

    I am floating in the community as I am waiting some definitive feedback on a "bug" / "problem" we have in KNM Authentication (waiting since almost a month now) and I thought I could give something back first.

    Best Regards