Video Screencast Help
Symantec to Separate Into Two Focused, Industry-Leading Technology Companies. Learn more.

Using Model_Num for HWI Image Scripts

Created: 26 Mar 2008 | 2 comments
Language Translations
dfnkt_'s picture
0 0 Votes
Login to vote

A lot of people these days are doing hardware independent imaging. Some of us are using programs and others (like me) are doing it by hand. The scripts involved in doing HWI imaging can sometimes be confusing; hopefully I can shed some light on one of them.

The Beginning

Some of you who are doing hardware independent imaging might have a script similar to the following:

REM Token Replacement / Driver Injection
REM the next line, ReplaceTokens, is a reserved keyword, the REM statement is so DOS will ignore the command

REM ReplaceTokens .\Sysprep\Sysprep.inf .\temp\%ID%.inf

F:\RDeploy\Windows\FIRM copy F:\temp\%ID%.inf Prod:\sysprep\sysprep.inf

REM get rid of the old aclient.cfg file

F:\RDeploy\Windows\FIRM delete prod:\aclient.cfg
REM This section is devoted to injecting model specific drivers

echo Hardware Model number is %#!computer@model_num%

if "%#!computer@model_num%" =="xxxxx"   goto folder_name

The Explanation

The syntax for the token used in the last line is "%[#][^]!{table name}@{column name}%" The brackets mean that the symbol is optional while the braces indicate something that is required. In the script "%#!computer" is referring to the Computer table in the eXpress database while the "@model_num" refers to a specific column within the computer table. Now the symbols that prefix "computer" such as "%#!" might seem a little confusing, here is what they mean:

% = token
# = user defined token
^ = global flag
! = specifies the eXpress DB, required for all user defined tokens.
@ = tells it to look for the column in the table, also required for all user defined tokens.
* = flag to indicate that the following text is a SQL query

On to the Rest of the Article

The column name used in the script is the "model_num" column which is sometimes cryptic, especially if you're using HP computers like we are. A line out of my script which refers to a DC770 looks like this:

if "%#!computer@model_num%" =="0A58h"    goto dc7700
:dc7700
F:\RDeploy\Windows\FIRM -recurse copy F:\drivers\dc7700 Prod:\drivers
goto Exit
:Exit
exit

Is that in English?

What this says is when the model_num = 0A58h go to section :dc770 in my script which then tells it to use FIRM.exe to recursively (include subfolders)copy the drivers from a folder named "dc7700" to the C:\ on the target computer.As you can see, 0A58h isn't very descriptive. You can replace "model_num" with "prod_name" if you want the script to make a little more sense and be more easily readable, however there IS a catch.

As you can see in the screenshot below I selected both model_num and prod_name from the computer table using a distinct query to eliminate duplicates. You can see that there are models that are the same model_num with a close bit still distinct entry in prod_name. This would require multiple entries in a script using prod_name.

Let's look at what my script would be if I replaced "model_num" with "prod_name"

if "%#!computer@prod_name%" =="HP Compaq dc7700 Convertible Minitower"    goto dc7700
if "%#!computer@prod_name%" =="HP Compaq dc7700p Convertible Minitower"    goto dc7700
:dc7700
F:\RDeploy\Windows\FIRM -recurse copy F:\drivers\dc7700 Prod:\drivers
goto Exit
:Exit
exit

Notice that although the prod_name "HP Compaq dc7700 Convertible Minitower" and "HP Compaq dc7700p Convertible Minitower" are close, they are not identical. This causes us to have 2 entries in the script for basically the same computer. If you stick with model_num, 0A58h takes care of both of them.

A Query-rific Query

Regardless of whether you choose to use model_num or prod_name, the following query should help you figure out exactly what models and product names you need to put into your script. Just keep in mind that if you use model_num then you have to put the model_num in the quotes, you can't use computer@model_num == "Compaq dc7700 Convertible Minitower". The only way this would be valid is if the value of "model_num" for the dc7700 was "Compaq dc7700 Convertible Minitower"; however this is not the case. Open Microsoft SQL Server Management Studio, the express version, or your tool of choice and run the following query.

SELECT distinct model_num, prod_name FROM computer

This query should return all the distinct entries in the computer table for model_num and prod_name. From here you can put your script together. If you want to make the results a bit more readable, you can name the columns using the following query in place of the one above:

SELECT distinct model_num AS "Model Number", prod_name AS "Product Name" FROM computer

He's a Nice Guy

Since I'm a nice guy, I've included some of the model_num entries from my table, which should be the same in yours for the HP/Compaq computers. Be sure to check your table, but these should be the same. I've included 2 DELL models as well, we have a couple of them.

0968h == HP/Compaq DC7100
0890  == HP/Compaq NC6000
08BC  == HP/Compaq NX5000
09F0h == HP/Compaq DC7600
0A58h == HP/Compaq DC7700
308A  == HP/Compaq NC6220
30AA  == HP/Compaq NC6320
30C0  == HP/Compaq 6510b
30C5  == HP/Compaq 8510w
0J2628 == DELL Optiplex GX260
"Optiplex GX260" == DELL Optiplex GX260
"Optiplex GX150" == DELL Optiplex GX150

The End

I hope this can help someone flesh out their script or inspire them at least to start with Hardware Independent Imaging if you haven't already. You might want to checkout SKAKID's article on imaging which points to a tool called HIIS from AltrinsicSolutions which I have tried and was very impressed with.

Comments 2 CommentsJump to latest comment

dfrancis's picture

Very good information. When we moved to HII we used prod_name instead of model_num but ran into issues with the if statements. What we found up doing is simply naming the directories as the product names and copying that way. This shortened our script a little bit and left us with a "plain English" directory structure when we need to update drivers down the road.

The script would look something like this:

Firm -recurse Copy "Q:\drv\%#computer@prod_name%\*" "prod:\drv"

And our directory structure on the image store (in this case Q:) would have folders such as:

Q:\drv\Dell OptiPlex 745
Q:\drv\Dell OptiPlex 755
Q:\drv\Dell OptiPlex GX620

--Dave

If a forum post solves your problem, please flag it as a solution. If you like an article, blog post or download vote it up.

0
Login to vote
dfnkt_'s picture

Wasn't aware that you could token the FIRM copy path, very interesting! Thank you for sharing.

0
Login to vote