7 Replies Latest reply on Jan 23, 2018 8:36 AM by patchmangler

    How to query custom variables?

    patchmangler Apprentice

      I've added some custom variables to devices, for example 1 of them is named 'Environment'. How do I query those variables? When setting up the query I pointed it to the following:

       

      "Computer"."Custom Data"."Forms"."Server Info"."Environment" EXISTS

       

      Also set the column display to point to the same variable.

       

      The query is returning no results. Also, not all of the variables I created are listed under the "Server Info" qui when I'm creating the query. Am I looking in the right place or should I be doing this differently?

        • 1. Re: How to query custom variables?
          ferrispd Apprentice

          I have to admit, I haven't done anything with the Custom Data Forms yet.  I have used "Manage Software List" "Inventory"->"Custom Data"->"Registry Items" to populate some information in the computer inventory that has been necessary for my queries.  I have also had problems with the "Exists" in queries.  What I did was use "<>" and in the value field I just entered a space. "<>" is Not equal to.

           

          "Computer"."Custom Data"."Forms"."Server Info"."Environment" <> " "

           

          I hope this helps.

          -Pat

           

          PS.  I am not having that problem with EXISTS anymore, but I remember I did at one time.

          • 2. Re: How to query custom variables?
            phoffmann SupportEmployee

            So ...

             

            • Please (always) state what version & service pack level you're on. If you're on something that's (say) 5 years old, then it's possible it's a bug or so that may have been fixe since then and we can point out a few updates.

             

            Now...

             

            "Custom Data" is pretty regular as far as inventory goes (and - column settings).

             

            So if you know what you're lookign for, it may just not be there.

             

            Piece of advice / helpful tip I use -- use the QUERY tool and create a Query for the "Computer"."Custom Data"."Forms"."Server Info"."Environment" BNF data-path, and use the "=" parameter in the query ...

             

            ... on the right-hand side this will show you what values exist in the database for this field. This will allow you to check what's actually in the DB. That way you can make sure that the stuff you're looking for actually *IS* in the DB in the first place.

             

            Start with that and work from there?

            1 of 1 people found this helpful
            • 3. Re: How to query custom variables?
              patchmangler Apprentice

              "Piece of advice / helpful tip I use -- use the QUERY tool and create a Query for the "Computer"."Custom Data"."Forms"."Server Info"."Environment" BNF data-path, and use the "=" parameter in the query ..." - So when I made this post the query I mentioned was in the query tool as follows:

               

              "Computer"."Customer Data"."Forms"."Server Info"."Environment" EXISTS

              No values appear under "Display scanned values:"

               

              If I change it to Like or "=", still no values appear.

               

              I know the variable data is in the database because I've been pulling it into a spreadsheet for several weeks now.

               

              This is what the query looks like:

               

              2018-01-11_13-46-51.jpg

               

              This is an example of the variables listed for one of our servers:

               

              2018-01-11_13-48-17.jpg

              1 of 1 people found this helpful
              • 4. Re: How to query custom variables?
                phoffmann SupportEmployee

                That's more than a little odd.

                 

                I would potentially poke support about that and be ready to provide them with a DB-backup.

                 

                The Query tool *SHOULD* show you what's picked up in the inventory - modelled or not ... so I'm a bit confused by "the data being in there", yet the query tool not showing it. Would need to have a look at the DB structure to guess at why that's not happening.

                 

                Daft question but (just as a sanity check) - if you do the "=" operator for any other inventory item under CUSTOM DATA, do you get values displayed?

                 

                Also - how (un-)comfortable are you with running SQL statements / interpreting them. I could throw you a couple of basic checks (nothing invasive) to potentially make more sense of your data being there?

                • 5. Re: How to query custom variables?
                  patchmangler Apprentice

                  After more research I think I've determined I'm going about this all wrong. I'm not actually using any Custom Data Forms, I just created one because I read somewhere that it was required to be able to query Variables.

                   

                  Here's what I was trying to do:

                   

                  1) Add Variables to each device designating Environment and whether I want the device to receive a specific patch for a specific application (ex: Adobe Reader).

                  2) Setup a Query for each of the Variables.

                  3) Use the query as custom vulnerability detection logic.

                   

                  Perhaps I'm taking the wrong approach? I was hoping to avoid having to add registry keys to each device, but it sounds like that may be the simplest method for what I'm trying to do? When you have multiple servers with various applications at various version levels (intentionally due to compatibility issues), utilizing device groups and patch groups do determine detection can become somewhat of a nightmare. Or should I create an "Update Adobe Reader" group and a "Don't Update Adobe Reader" group, place the appropriate servers in each group, then use vbscript in the detection logic to query group membership? Or can I query group membership in the query gui and then use the query section in the detection logic? Or any other suggestions?

                  • 6. Re: How to query custom variables?
                    phoffmann SupportEmployee

                    There's a bunch of ways you can skin this particular cat.

                     

                    • You can have static groups on the Core of the "DO / DO NOT target" variety.
                    • You can have environment variables (pretty sure we pick those up with standard inventory BTW). Or some other "Target me / Don't Target me!" type value ... which you can then query in a custom definition to do anything you darn well like.

                      Just because it's called "patch manager" doesn't mean it's not AWESOMELY abusable in all manner of ways. Here's something to get started -- How To: Create a Custom Vulnerability Definition in Patch and Compliance Manager .
                    • ... and there will be more. really (if I weren't so tired I'd come up with a 3rd way) ... but it all amounts to a variety of "figure something that works for you" (be it a text file. a reg-key or a static query / group) ... and use that.
                    • 7. Re: How to query custom variables?
                      patchmangler Apprentice

                      thanks phoffmann, what I ended up doing was a combination of device groups and scoped scans, seems to be working well so far, appreciate the assistance!