2 Replies Latest reply on Jun 7, 2012 1:38 PM by brkdncr

    Is there a way to inject the Provisioning task name into a machine so that I can query it in Inventory?

    Apprentice

      My goal is to be able to run a query against computers to see what machines have been provisioned as, and when they were provisioned.  I'd like this information to be inserted during the provisioning task and include 1) the name of the provisioning task and 2) the date.

        • 1. Re: Is there a way to inject the Provisioning task name into a machine so that I can query it in Inventory?
          JSMCPN Expert

          Closest I could think of would be to add a Template Variable to each of your templates, and define the variable as the name of the template.  Then you could mount the new OS's SOFTWARE hive, REG WRITE the variable and the date (according to WinPE) to the HKEY_LOCAL_MACHINE\SOFTWARE\Intel\LANDesk\Inventory\Custom Fields registry so that Inventoy Scanner will pick it up.  You'd have to unblock the new custom data attributes in the Inventory service.

           

          Something along the lines of (assuming 64-bit OS):

          REG WRITE "HKEY_LOCAL_MACHINE\TEMP_SOFTWARE\Wow6432Node\Intel\LANDesk\Inventory\Custom Fields" /v LastProvisioningTemplate /t REG_SZ /d %ldProvTemplate% /f

          REG WRITE "HKEY_LOCAL_MACHINE\TEMP_SOFTWARE\Wow6432Node\Intel\LANDesk\Inventory\Custom Fields" /v LastProvisioningDate /t REG_SZ /d %DATE% /f

           

          To see how to mount an offline registry hive, modify it with LANDesk database/variable info, and unmount the hive, see my document:

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

           

           

          EDIT:  My apologies - My LD9/Provisioning updates and attachments to DOC-9051 have been "PENDING APPROVAL" for the last 8 months so I will paste it here:

           

           

           

           

          How to inject Inventory data during Provisioning or OSD

          Purpose:


          To show how LANDesk can be used to recycle existing information from the LANDesk Database back into a newly re-imaged computer.

          For this document, I chose to use the Windows "Description" inventory data, but the methodology could certainly be applied to any number of other useful pieces of Inventory data - the possibilities are endless!


          Background:


          In a former environment, I used a VBScript for Device Name (NetBIOS/hostname) creation after OSD.  The PC naming convention is to use a 3-digit alpha code unique to each physical location, and the last six digits of the onboard Ethernet MAC address.  The alpha code is determined in VBScript by obtaining the IP address of the Ethernet adapter and matching the 2nd octet up to a string in a dictionary.

           

          For example:

          Arapahoe Ridge High School = ARH - network is 10.66.x.x - VBScript says if 2nd octet is 66 then device name will begin with ARH

          Pioneer Elementary School = PIE - network is 10.67.x.x

          Manhattan Middle School = MAM - network is 10.68.x.x

           

          So device names end up being ARH3CF1BF, PIE789FAC, MAM82EF08, etc.

           

          This naming convention is EXCELLENT when it comes to writing LANDesk scopes, queries, Active Directory automation, and custom scripts that must know the physical location of the computer.  This convention is TERRIBLE for actual identification of a single machine in the flock.

           

          That is what Microsoft created the "Description" for, AKA the SRVCOMMENT value data in the HKLM\SYSTEM\CurrentControlSet\Lanmanserver\Parameters\ registry key.  Computers need a standardized network name that makes scripting easy, AND a Friendly-Name that is useful to us Humans.

          desc.JPGdevdesc.JPG

           

          When reimaging a whole lab like the BOH Library, it's time consuming to go around and re-describe each computer, especially when the description is the same as it was before.

           

          _________________________________________________________________________________________________________________________________

           

          HOW-TO for Provisioning (added September 13, 2011, tested on 9.0 SP2)


          Attached to this document is a Provisioning "Include" template for 9.0 SP2 - it greatly simplifies the Description injection over the Classic OSD method outlined in the next section.  It uses no INI or BAT files, requires no image modifications, and occurs in WinPE before an image ever boots up.

           

          The Include template performs the following steps, and should be added to the Post-OS Installation phase at some point after the new OS image has been laid down to C: and the volume is writable:

           

          Step 1 - Back up the SYSTEM registry hive to SYSTEM.BAK

          Step 2 - REG.exe mounts the SYSTEM registry hive as OSDSYSTEM

          Step 3 - REG.exe writes the new Description to the registry, using a Variable called "DeviceDescription" which references "Computer"."Description" from the DB

          Step 4 - REG.exe unmounts the OSDSYSTEM registry hive.

           

          That's it!  All you have to do is import the attached Include and include it in your Post-OS Installation phase of a Provisioning template.

           

           

           

          HOW-TO for Classic OSD (tested on LDMS 8.8 SP3 and 9.0 SP2):

           

          This is my old method for LANDesk 8.8 OSD and a Windows XP image, but it still works in LANDesk 9 and Windows 7.  Unlike the Provisioning Include method above, this process happens AFTER the image has been deployed, as part of the Sysprep routine.  It would be called during GuiRunOnce in WinXP, or during the Specialize phase as a RunSynchronousCommand in Win7.

           

          Step 1 - In my \Drivers\Common\ directory that gets copied to each computer during my OSD driver injection routine (using CopyDrivers.exe), I created a DESCRIPTION.INI file.

           

                         This file contains a single line with a variable called %DESC%

           

          Step 2 - In my LANDesk OSD script, I added a line that runs:

           

          TOKREPLW.EXE C:\DRIVERS\DESCRIPTION.INI DESC="%Computer - Description%"

           

                         (NOTE:  Quotes around the LD database variable are critical since descriptions usually have spaces)

                         This line reads the existing Description from the LD database and replaces the %DESC% variable in the INI file that lives on the freshly imaged drive

           

           

          Step 3 - In my post-OSD batch file (called from GuiRunOnce) that runs after Windows Mini-Setup finishes and reboots, I added two lines:

           

          SET /P DESCRIPTION=<C:\DRIVERS\DESCRIPTION.INI
          REG ADD "HKLM\SYSTEM\CurrentControlSet\Services\lanmanserver\parameters" /v srvcomment /t REG_SZ /d "%DESCRIPTION%" /f
          

           

                         The first line uses SET /P to read the new string from DESCRIPTION.INI, set it as an environment variable

                         The second line uses REG to write the string stored in the variable back to the Registry.

           

           

           

          Voila!  Every time you reimage a computer, LANDesk can now recycle the current Description from the DB.

          Happy LANDesking everyone.

          • 2. Re: Is there a way to inject the Provisioning task name into a machine so that I can query it in Inventory?
            Apprentice

            Thanks.  I'll take a look at both methods (WinPE and Sysprep) soon.