3 Replies Latest reply: May 16, 2012 10:27 AM by AspenSkier RSS

    Update Computer Description via batch file / script


      Hi all,


      I have an asset spreadsheet containing machine names and an asset (seperate cells). 


      Machine Name          Asset

      LONMACHINE01       00130

      LONMACHINE02       00131



      What I wanted to know, was whether it is possible to create a batch file/script to push out the value of the asset column and update the Computer Description field in the registry where the remote computer and machine Name in the spreadsheet match (unique identifier)


      Reason being is that the asset is only recorded on each PC as a sticker, and therefore cannot be retrieved through landesk.


      Any ideas on how I could automate this process ?


      How would I inform LD, that once the first row has been processed, to move to the next row, discover next machine in list and push out asset tag value to the computer description key in registry.


      Any thoughts would be most welcome.




        • 1. Re: Update Computer Description via batch file / script

          Maybe you could look at it a different way. instead of landesk going through the spreadsheat have the computer.

          eg create a batch script  (or another language i normally use c/c#), something that follows a logic like:

          for each row in csv file. if collum machine name = computername then description = asset number

          this script could then be schedualed for each device...

          • 2. Re: Update Computer Description via batch file / script

            Nice suggestion.  Didnt think of Computer doing the work.  Sometimes you cant see the wood for the trees.


            However, I am not good at writing scripts, or have not done this before and wouldnt know where to start or the format/syntax for such a script. 


            I will google and see if I can try and locate something similar.

            Thanks for assistance.

            • 3. Re: Update Computer Description via batch file / script

              here a few things that might possibly help you put somethign together:


              oh, wait...I can't add attachments to this post!



              I've got a provisioning template that I include in some of my production image deployment templates.  This include simply updates the computer's description with the value that 'was' in the LDMS inventory prior to imaging.  I'll explain how it works and maybe you can rework it to do what you need.


              The include simply injects two provisioning scripts and updates the system registry like this:


              ComputerDescription gets injected as "c:\administration\description.ini"

              -this file contains a single line of text as follows:



              Next the injected file is udpated where %ComputerDescription% is replaced with a template variable called ComputerDescription.

              -the template variable is set as

              -Computer."Description"  {which is a database value}


              Next the 2nd script is injected as "setDescription.bat"

              -this file contains the following text:



              set /p DESCRIPTION=<C:\Administration\description.ini

              reg add "HKLM\SYSTEM\CurrentControlSet\Services\lanmanserver\parameters" /v srvcomment /t REG_SZ /d "%%DESCRIPTION%%" /f


              The last step of the include is to simply execute the batch file.


              ~anyway, this gets included in the SYSTEM CONFIGURATION section of most imaging templates and always restores the original computer description back to the machine.  There may be a way to simply this process to eliminate the .INI file and to use action variables, however I never got those things to work.




              So you might apply this to work for your needs as follows:


              add your CSV file to the provisioning templates in the OSD section of the console

              add a separate script like the one that S.R. suggested for handling the scanning of the CSV

              add the setDescription.bat (above) as well

              create a template which injects the CSV file to a location on the target computers

              inject the scanning script as well.

              next execute the scanning script against the CSV; presumably this script would generate a file that contains your computer description

              inject the setDescription.bat script

              run the setDescription.bat against the description file

              next reboot your computer*

              and finally, call the inventory scanner to update your LDMS inventory with the new computer description.



              *I found that the reboot was necessary because the LDMS inventory wouldn't update properly without it.




              I'm leaving out the details of the scanning script as I don't know what to suggest on that front.  It would certainly be more tidy to keep all of these actions imbedded in a single script so that you would only have to send the .CSV and the .SCRIPT file, however I've found that my tidy provisioning templates fail but they can work if they are broken out as I described above.


              good luck.