Deployment Solution

 View Only
  • 1.  HII script problem

    Posted Feb 20, 2009 07:35 AM
    I am using HII and have been using it for about 8 months now with no problems. This issue I am currently having isn't so much a problem, just an inconvenience.

    Right now I run the script for the token replacement as a "run this script" option. Works great, no problems. However, it does become an inconvenience every time we get a new computer model in, as I have to update the script in each location. I would like to just run the script from a file, this way I only have to update the script in 1 location. We have several different jobs that run for different users so each time we get a new model in I have to update the jobs in multiple locations.

    I've saved it as a .bat and as a .cmd to run it from DOS after the image is downloaded and before syspep runs. It works just like before, it copies the files and gets the correct drivers. The one thing happening though is that the computer is not automatically getting re-named like it would before. Instead %compname% is in the box and I have to manually enter the name. What am I missing that causes this to work fine when using the "run from script" command but doesn't name it when I point to a file?

    Here is my script. Again, works just fine when run from script but when using the run from file option it does everything correct except it won't automatically re-name the computer.


    REM token replacement on the inf file
    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
    Firm copy .\temp\%ID%.inf prod:sysprep\sysprep.inf
    REM get rid of the old aclient.cfg file
    firm delete prod:aclient.cfg
    REM This section would normally be devoted to injecting model
    specific drivers
    echo Hardware Model number is %#!computer@model_num%
    set model=%#*"SELECT REPLACE(model_num,' ','_') FROM computer WHERE computer_id=%ID%"%
    if "%model%" =="D815EFVU" goto om815
    if "%model%" =="D845GERG2" goto 845GE
    if "%model%" =="0WF810" goto Opti745
    if "%model%" =="0GX297" goto Opti745
    if "%model%" =="0WK833" goto Opti745
    if "%model%" =="0GM819" goto Opti755
    if "%model%" =="0DR845" goto Opti755
    if "%model%" =="0PU052" goto Opti755
    if "%model%" =="00T606" goto Gx260
    if "%model%" =="0N6016" goto Gx270
    if "%model%" =="0U8633" goto Gx270
    if "%model%" =="0H1489" goto Gx270
    if "%model%" =="0U1324" goto Gx270
    if "%model%" =="0CG566" goto Gx270
    if "%model%" =="0U9268" goto Gx270
    if "%model%" =="0H1105" goto Gx270
    if "%model%" =="0T8262" goto Gx270
    if "%model%" =="0UT806" goto Gx520
    if "%model%" =="0PJ478" goto Gx520
    if "%model%" =="0NF743" goto LatD520
    if "%model%" =="0KX350" goto LatD620
    if "%model%" =="0TD761" goto LatD620
    if "%model%" =="0JK187" goto LatD620
    if "%model%" =="0FT292" goto LatD620
    if "%model%" =="0WM416" goto LatD630
    if "%model%" =="0KU184" goto LatD630
    if "%model%" =="01W890" goto LatD800
    if "%model%" =="0JF242" goto LatD820
    if "%model%" =="D865GLC" goto mpc865
    if "%model%" =="D915GRV" goto mpc915
    if "%model%" =="D945GCZ" goto mpc945
    if "%model%" =="X3100" goto mpc3100
    if "%model%" =="2656AFU" goto ibmr31
    if "%model%" =="L19DX_Series" goto mpc424
    if "%model%" =="0G5611" goto GX280
    if "%model%" =="0C7195" goto GX280
    if "%model%" =="0AA8h" goto hp7800
    if "%model%" =="3031h" goto hp7800
    if "%model%" =="30C0" goto hp6710b
    if "%model%" =="30C5" goto hp8510p
    if "%model%" =="30DD" goto hp6530b
    if "%model%" =="0F4491" goto I4600
    if "%model%" =="0T9369" goto I4600
    if "%model%" =="0AA0h" goto hp4600
    REM If we didn't find a match, just exit
    goto Exit
    m815
    firm -recurse copy .\drivers\om815 prod:\drivers
    firm -recurse copy \drivers\halaacpi.dll prod:windows\system32\hal.dll
    goto Exit
    :845GE
    firm -recurse copy .\drivers\845GE prod:\drivers
    goto Exit
    pti745
    firm -recurse copy .\drivers\Opti745 prod:\drivers
    goto Exit
    pti755
    firm -recurse copy .\drivers\Opti755 prod:\drivers
    goto Exit
    :Gx260
    firm -recurse copy .\drivers\Gx260 prod:\drivers
    goto Exit
    :Gx270
    firm -recurse copy .\drivers\Gx270 prod:\drivers
    goto Exit
    :Gx520
    firm -recurse copy .\drivers\Gx520 prod:\drivers
    goto Exit
    :LatD520
    firm -recurse copy .\drivers\LatD520 prod:\drivers
    goto Exit
    :LatD620
    firm -recurse copy .\drivers\LatD620 prod:\drivers
    goto Exit
    :LatD630
    firm -recurse copy .\drivers\LatD630 prod:\drivers
    goto Exit
    :LatD800
    firm -recurse copy .\drivers\LatD800 prod:\drivers
    firm -recurse copy \drivers\halaacpi.dll prod:windows\system32\hal.dll
    goto Exit
    :LatD820
    firm -recurse copy .\drivers\LatD820 prod:\drivers
    goto Exit
    :mpc865
    firm -recurse copy .\drivers\mpc865 prod:\drivers
    goto Exit
    :mpc915
    firm -recurse copy .\drivers\mpc915 prod:\drivers
    goto Exit
    :mpc945
    firm -recurse copy .\drivers\mpc945 prod:\drivers
    goto Exit
    :mpc3100
    firm -recurse copy .\drivers\mpc3100 prod:\drivers
    goto Exit
    :ibmr31
    firm -recurse copy .\drivers\ibmr31 prod:\drivers
    firm -recurse copy \drivers\halaacpi.dll prod:windows\system32\hal.dll
    goto Exit
    :GX280
    firm -recurse copy .\drivers\GX280 prod:\drivers
    goto Exit
    :hp4600
    firm -recurse copy .\drivers\hp4600 prod:\drivers
    goto Exit
    :hp7800
    firm -recurse copy .\drivers\hp7800 prod:\drivers
    goto Exit
    :hp6530b
    firm -recurse copy .\drivers\hp6530b prod:\drivers
    goto Exit
    :hp6710b
    firm -recurse copy .\drivers\hp6710b prod:\drivers
    goto Exit
    :hp8510p
    firm -recurse copy .\drivers\hp8510p prod:\drivers
    goto Exit
    :I4600
    firm -recurse copy .\drivers\I4600 prod:\drivers
    goto Exit
    :mpc424
    firm -recurse copy .\drivers\mpc424 prod:\drivers
    goto Exit
    :Exit
    exit


  • 2.  RE: HII script problem

    Posted Feb 20, 2009 10:27 AM
    %COMPNAME% is a token and is supported in your embedded script. If you want to use a token outside of it, like in a batch script, you needs to REM Replacetokens on a template first, then copy that to the machine.

    In your case, I do not think you can have a script call another to use Replacetokens. It should be embedded, so you may need a first step to do this:
    REM Deploy XP SP3 Image and Drivers
    REM ReplaceTokens .\Images\XPsysprep.txt .\temp\%ID%-sp3.inf

    Then call your external bat in the next step and take the token replacement piece out of this second step. Just copy the file that was already tokenized in step 1.



    I will include a script I set up for this so I don't have to update it each time for new models now. This is for use with WinPE2. You can easily modify it to work in DOS.

    Notes: only put hal.dll in the drivers folder if you wish to use hal injection. If you model name contains spaces, replace them with underscores in the folder name, ex. Dell_Model_111.

    --------


    REM Deploy XP SP3 Image and Drivers
    REM ReplaceTokens .\Images\XPsysprep.txt .\temp\%ID%-sp3.inf

    %ALTIRIS_SHARE%\RDeploy\Windows\rdeployt.exe -noprompt -md -f%ALTIRIS_SHARE%\images\XPSP3.IMG -sz1:100p -nobw -nooem

    %ALTIRIS_SHARE%\RDeploy\Windows\Firm.exe Copy %ALTIRIS_SHARE%\temp\%ID%-sp3.inf PROD:\Sysprep\Sysprep.inf
    DEL %ALTIRIS_SHARE%\temp\%ID%-sp3.inf

    REM get rid of the old aclient.cfg file
    %ALTIRIS_SHARE%\RDeploy\Windows\firm.exe delete prod:aclient.cfg

    REM inject the aclient source and inp
    %ALTIRIS_SHARE%\RDeploy\Windows\firm.exe copy .\Aclient.exe PROD:\drivers\_post\aclient\Aclient.exe
    %ALTIRIS_SHARE%\RDeploy\Windows\firm.exe copy .\Aclient.inp PROD:\sysprep\Aclient.inp

    echo Hardware Model number is %#!computer@model_num%
    set model=%#*"SELECT REPLACE(model_num,' ','_') FROM computer WHERE computer_id=%ID%"%

    :SP3
    %ALTIRIS_SHARE%\RDeploy\Windows\firm.exe -recurse copy .\Images\Drivers\XPPROSP3\%model% PROD:\drivers
    if exist %ALTIRIS_SHARE%\Images\Drivers\XPPROSP3\%model%\hal.dll goto InjectHAL
    goto Exit

    :InjectHAL
    %ALTIRIS_SHARE%\RDeploy\Windows\firm.exe Copy PROD:\drivers\hal.dll PROD:\windows\system32\hal.dll
    goto Exit

    :Exit
    exit


  • 3.  RE: HII script problem

    Posted Feb 23, 2009 04:54 AM
    Thanks a lot. This is what I needed. Now I just have an embedded script that calls the file as you suggested. Looks like this, where drivers.bat is the script that copies the drivers based on the model ID.

    REM token replacement on the inf file
    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
    firm copy .\temp\%ID%.inf prod:sysprep\sysprep.inf
    firm delete .\temp\%ID%.inf
    REM get rid of the old aclient.cfg file
    firm delete prod:aclient.cfg
    REM This section would normally be devoted to injecting model
    specific drivers
    echo Hardware Model number is %#!computer@model_num%
    set model=%#*"SELECT REPLACE(model_num,' ','_') FROM computer WHERE computer_id=%ID%"%
    .\Scripts\drivers.bat