6 Replies Latest reply on Dec 11, 2018 12:47 PM by karlehenry

    Compare Variable Assistance

    karlehenry Apprentice

      I am trying to run a compare variable action using if conditions to apply an action on machines that are deployed running Bitlocker.

       

      I want to look up the database field :

       

      "Computer"."Mass Storage"."Drive Encryption"."Protection Status"

       

      This field has two states:

       

      "1 - on" and "0 - off"

       

      What i want is when "1 - on" is found, it runs a script and if it is not found, it continues.

       

      What I have done:

      1. Created public variable with Database value with the above information

      2. I created a provision template and put an if condition statement under the System Migration and use the Compare Variable. See attached Graphiccompare.JPG

       

      For now, i just want the Wait window to pop up to verify functionality.  It seems this does not work and I am not sure why.

       

      I have tries the value to be = and 1 - on as well and it fails.

       

      Thoughts, Tips, Comments?

       

      Any help is appreciative.

        • 1. Re: Compare Variable Assistance
          phoffmann SupportEmployee

          Does the device you run this against actually *HAVE* the relevant value in inventory in the first place?

           

          If you're querying a value that the device in question doesn't have in inventory (say - because of a minimal bare metal entry), you're going to run into issues for instance?

          • 2. Re: Compare Variable Assistance
            karlehenry Apprentice

            phoffmann

            This is a great question indeed and normally I would probably make this mistake.

             

            Yes I have confirmed the values are there and have been testing on a machine that does have the value but I made a discovery yesterday and why this is happening but now do not know how to get the result i wish.

             

            The Machine has a internal HDD of 512GB which is encrypted and in the database value:

            "Computer"."Mass Storage"."Drive Encryption"."C:"."Protection Status" Does infact equal "1 - on"

            but

            in the database value:

            "Computer"."Mass Storage"."Drive Encryption"."E:"."Protection Status" = "0 - off"

             

            now the E is an attached Portable 4TB HDD that is not encrypted, so the result is fine.

             

            both

             

            "Computer"."Mass Storage"."Drive Encryption"."C:"."Protection Status" and "Computer"."Mass Storage"."Drive Encryption"."E:"."Protection Status" both return NULL values when the template is ran, and when you try to build a query of it.

             

            the only query result that returns a status is: "Computer"."Mass Storage"."Drive Encryption"."Protection Status" and in my case, it is only looking at the E:

             

            How can i get it to focus on the C:?

            • 3. Re: Compare Variable Assistance
              phoffmann SupportEmployee

              Hrmm - so the problem is that this is a 1:* (one-to-many) relationship, and effectively you're being hit by 3 values, when the logic is expecting back a single one.

               

              ONE way to do it (which seems like unnecessaryily cumbersome, but it's the first thing that came to mind) would be to do a script (i.e. - powershell or so) that queries the inventory data via API (see here -- Getting Started with the MBSDK (Example Scripts Included) ) where you can run a dynamic query & then incorporate a bunch of "if this then that..." type logic within the script itself (depending on what it is that you're trying to do) ?

               

              In particular, you can effectively "write" / create your query dynamically using data/information from this section - https://community.ivanti.com/docs/DOC-41092#jive_content_id_VII_Important_information_on_Column_sets_and_how_to_specify_… - to help you along with (so you can specify that the "name" of the drive must be "C" for instance) and go from there?

               

              There may be other / easier ways to it, but I'm suffering from a cold right now & for some odd reason, that's the very first thing that came to mind ... not super elegant, but it'll get you off the ground 'til someone can suggest something more straight forward perhaps?

              • 4. Re: Compare Variable Assistance
                karlehenry Apprentice

                My gut told me this would be your answer.

                 

                Using MBDSK do you need to have access to the SQL database or can it be ran natively from a client with an agent?

                 

                We are the odd ball where we do not yet have access to our Core, although, I am told i will have some kind of access in the near future, I know for sure it will not be the SQL database.

                 

                baby steps.

                • 5. Re: Compare Variable Assistance
                  phoffmann SupportEmployee

                  Err ... "yes" ...?

                   

                  So the MBSDK is a Web-service that you talk to (and authenticate to). THAT www-service (assuming you're "allowed") will then query the database. So "in a roundabout way" you talk to the database.

                   

                  However, you're talking to it using the inventory "query language format" (like building a query in the console) and the "console query format" in general.

                   

                  Baby-steps wise...

                  ... you're NOT talking to the SQL database directly. Fear not

                  ... you're talking to a web-service (and need to authenticate to it - not just "any" Tom, Dick or Harry is permitted - if you don't have access to the console, tough luck. I explain that in the article itself) ... and one of the things you can do with that, is running "on the fly" queries against "anything" in inventory.

                   

                  Have a look at the article - I've included a bunch of "copy & paste" type scripts (with lots of comments, and some intentional pitfalls), to try & make it as easy as possible & approachable as possible for folks who start from 0 intentionally (as I had to start there & prefer not to assume that an audience knows much more than me - zilch - when starting out) .

                   

                  Does that help?

                  • 6. Re: Compare Variable Assistance
                    karlehenry Apprentice

                    Thank you, it helps greatly!