Client Management Suite

 View Only
  • 1.  Sub-folder inventory

    Posted Dec 21, 2009 08:05 PM
    I'm trying to create a custom inventory task to get a few reg keys, but the problem is that the path changes.
    For example, I'm trying to get:
    HKLM/Software/Software1/Key
    HKLM/Software/Software2/Key
    HKLM/Software/Software3/Key

    The key is always the same, but the software changes there is no way I can predict it.

    Any idea of how to get it ?

    Thanks !


  • 2.  RE: Sub-folder inventory

    Posted Dec 22, 2009 11:05 AM

    Luiz,
    Not sure I understand...do you know what the "SoftwareX" key will be, or the items you need could be anything under the /Software branch, but will always have a sub-key under SoftwareX of "Key"?  That gets a bit tricky.  I think you'll need to use a foreach key, something like the following (extracted and modified from the NS6 custom inventories in AKB4237):

    <%set pathbeg="HKEY_LOCAL_MACHINE\SOFTWARE"%>
    <%set pathend="KeyName"%>
    
    <%foreach regkey="keypath" path="%pathbeg%"%>
      <%set testval = "reg:%pathbeg%\key:keypath.%keyname%\%pathend%\SomeValue1"
      <%if %testval% != ""%>	
         <z:row
            c0="<%writexml "key:keypath.%keyname%"%>"     
            c1="<%writexml "reg:%pathbeg%\key:keypath.%keyname%\%pathend%\SomeValue1"%>"
           c2="<%writexml "reg:%pathbeg%\key:keypath.%keyname%\%pathend%\SomeValue2"%>"
            c3="<%writexml "reg:%pathbeg%\key:keypath.%keyname%\%pathend%\SomeValue3"%>"      
         /> <%endif%> <%next%>

    The %if statement tries (I didn't test this) to see if the value of SomeValue1 is not an empty string (meaning it has some value), if that is the case then it writes a line to the output.



  • 3.  RE: Sub-folder inventory

    Posted Jan 06, 2010 08:42 PM
    Kyle,

    Thanks for the reply.
    Unfortunately, I don't know what the names will be, therefore, a seach will be needed.
    I'll test your approach and let you know the outcome.

    Regards,
    Luiz