6 Replies Latest reply on Sep 13, 2011 11:58 AM by JSMCPN

    need help pulling DATABASE VALUES for variables

    Specialist

      I would like to know how to use values in the inventory as variables for my provisioning tasks.  I thought I would start with trying to create a provisioning task that pulls the previous value for "COMPUTER DESCRIPTION" out of the inventory and then reapply that description to a computer that I have reimaged.

       

      <can't figure out why Landesk provides a checkbox for reapplying the computer name but doesn't include the description as an option!!!!????>

       

       

      so far I found a related post here:

      http://community.landesk.com/support/docs/DOC-9051

       

      -though it seems to apply to an older version of LDMS; at least to something other than provisioning.

       

      As described in this link, I was successfully able to use SET.EXE and REG.EXE to make reapplying the computer name possible. However, I can't seem to get access to the computer description value in the database.

       

      I'm trying to use a REPLACE TEXT action to take a value in a .INI file and replace it with a value from the database.  I'm trying to get at COMPUTER.DESCRIPTION, but I can't seem to figure out what to type into the "REPLACEMENT VALUE" filed for the provisioning action.  I've set the variable to DATABASE VALUE, now what am I supposed to type in the REPLACEMENT VALUE field?

       

      in my QUERIES I was able to successfully identify it as "Computer"."Description" and verify that the value exists in the database, what do I type into PROVISIONING to reference this database value?

       

      -it sure would be nice if the dialog box that helps faclilitate building queries was available when a person has to explicitly call out a database value in provisioning; seems like a no brainer to me but instead we're left to our own devices for typing in the value....

       

      -thoughts?

        • 1. Re: need help pulling DATABASE VALUES for variables
          Specialist

          according to my online help file with the console, the stored database values should be referenced as follows:

          under the heading of ACTION VARIABLE:

           

          Database value:

          Enter a database ID string, such as Computer.Network."NIC address"

          In my case I want to use my "computer description" so I am referencing my database value as: Computer."Description".

          I have confirmed that the file I want is listed in the root of a computer's inventory when I look at a the results of an inventory scan. I have also manually entered all of the steps in my provisioning template within a command line window and verified everything works.

          So at this point I think I resolved my problem with DATABASE NAME SYNTAX, however now my provisioning template won't complete successfully.

           

          My provisioning template looks like this:

          Step1, a .ini file is copied to the local disk which contains a general term, %ComputerDescription%

          step2, then the text ComputerDescription is replaced with a variable by the same name %ComputerDescription%; this step contains an ACTION VARIABLE which calls for the replacement of that variable with Computer."Description"

          Step3, some kind of environment variable is prepared with SET /p DESCRIPTION=<C:\Administration\test.ini

          Step4, next the registry is finally updated with the previous computer description according to REG add "HKLM\SYSTEM\CurrentControlSet\Services\lanmanserver\parameters" /v srvcomment /t REG_SZ /d "%DESCRIPTION%" /f

          -where the environment variable from Step3 appears at the end of the options

           

          Again, if I manually key all of this into my client from a command line, it works fine. When I use this with PROVISIONING I get an error on Step4:

           

          "FAILED, the specified user variable does not exist."

          -any thoughts?

          • 2. Re: need help pulling DATABASE VALUES for variables
            Specialist

            With your action using a variable do you have it in the template as  %%ComputerDescription%%. I remember getting that error using a variable yesterday and found out I had to double up on the % so provisioning reconizes it as a vairable.

            • 3. Re: need help pulling DATABASE VALUES for variables
              Specialist

              I have attached my template here; it is setup to be an INCLUDE that will be used with a more full-featured image deployment template.

               

               

              I finally sorted it out; I had one problem that was related to my database values and variable references then a second problem that had to do with file copy actions failing.

               

              Per the original document I cited, I was trying to copy a DESCRIPTION.INI file to the target computer ahead of doing the rename.  For some reason I can't copy some files to my target computers using the FILE COPY action; it fails.  To work around this I added the INI file as a SCRIPT and I am now injecting that script via the provisioning template.  This solved the latter problem.

               

              The former problem was resolved by figuring out how to format DATABASE VALUE field names; in this case the correct reference for the computer description is <Computer."Description"> without the brackets.  This pulls the correct value from the database.

               

               

              In terms of putting all together I ran into a few problems where I got USER VARIABLE DOES NOT EXIST when I attempted to inject the scripts.  This was solved by ensuring that the template had a template variable name which matched the one called out in the INI file, AND, to the point you were getting at in your reply, I needed to denote an environment variable with double %%s.

               

              Provisioning variables use single %s and environment variables on the target PC are denoted with double %%s.  You might double check your own work because the statement in your reply is not correct.

               

               

              Again, the template I created is attached here; it makes use of two injected scripts which are also attached.  The variable used here is %ComputerDescription% and it gets set to whatever is in the database for a given target computer.

               

              -anyway, this one is SOLVED.

              • 4. Re: need help pulling DATABASE VALUES for variables
                Specialist

                Ah ok so thats how that works! Cool thanks, yea the variable I was using was an environment one.

                • 5. Re: need help pulling DATABASE VALUES for variables
                  JSMCPN Expert

                  Nice work man!  Thanks for viewing and referencing my document on the Description injection

                   

                  Here's a challenge for ya:     Make this same thing happen in the Post-OS section while still in WinPE, without the use of any INI or BAT files!

                  Hint:  It involves putting the data straight into the registry of the newly deployed C: drive

                   

                  Jesse

                  • 6. Re: need help pulling DATABASE VALUES for variables
                    JSMCPN Expert

                    Hey AspenSkier - check out my updated document

                    http://community.landesk.com/support/docs/DOC-9051

                     

                    Provisioning Include template that handles Description injection without any batch files, INI files, image modifications, etc...