Skip navigation
This discussion is archived
451 Views 3 Replies Latest reply: May 16, 2012 10:27 AM by AspenSkier RSS
mrjoolz Rookie 5 posts since
Feb 13, 2012

Has received 1 of 9 achievements.
Currently Being Moderated

May 11, 2012 9:06 AM

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.

 

Ta

  • srenshaw Rookie 12 posts since
    Aug 30, 2011

    Has received 2 of 9 achievements.
    Currently Being Moderated
    1. May 14, 2012 5:00 AM (in response to mrjoolz)
    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...

  • AspenSkier Specialist 479 posts since
    Apr 29, 2010

    Has received 3 of 9 achievements.
    Currently Being Moderated
    3. May 16, 2012 10:27 AM (in response to mrjoolz)
    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:

    -%ComputerDescription%

     

    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:

    c:

    cd\administration

    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.

More Like This

  • Retrieving data ...

Bookmarked By (0)

Legend

  • Correct Answers - 20 points
  • Helpful Answers - 10 points
LANDESK Community powered by Jive SBS® 4.5.7.1  |  Legal Notices  |  Privacy Policy  |  Icon 

TweeterOn Twitter  |  Icon FacebookOn Facebook © 2007 LANDESK Software