SCCM 2012 – Architecture Agnostic Dell CCTK WinPE Bios Package

I’m tired of choosing between our 32-bit and 64-bit Dell CCTK packages. We needed separate packages since the 32-bit cctk doesn’t run in Windows 7 x64, and the 64-bit cctk doesn’t run in x86 WinPE. This post will show you how to create a cmd wrapper to pass arguments to the appropriate executable for the running architecture.

  1. Download CCTK and install.
  2. Use the files that the cctk installer places in it’s installation directory to create the following folder structure in your package source directory. The files are usually kept in C:\Program Files (x86)\Dell\CCTK\X86 and ..\X86_64.
     \dell-cctk
     \dell-cctk\x86
     \dell-cctk\x86\
     \dell-cctk\x86\cctk.exe and supporting files
     \dell-cctk\x86\HAPI
     \dell-cctk\x64
     \dell-cctk\x64\cctk.exe and supporting files
     \dell-cctk\x64\HAPI
    
  3. Create a file named cctk.cmd in the \dell-cctk directory, and paste in the following code. The large majority of this code was re-purposed from the awesome blog post here: Batch Command-Line Arguments. This script will accept up to three arguments, and pass them to the correct cctk executable.
    @ECHO OFF
    REM Parse Arguments
    SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
    
    SET ARGV=.%*
    CALL :PARSE_ARGV
    IF ERRORLEVEL 1 (
      ECHO Cannot parse arguments
      ENDLOCAL
      EXIT /B 1
    )
    
    REM ---START MAIN LOOP---
    ECHO == Seting BIOS Settings ==
    
    REM Determine Arch
    IF "%PROCESSOR_ARCHITECTURE%" == "AMD64" GOTO :X64
    GOTO X86
    
    :X64
    SET CCTKPath="x64"
    GOTO RunCCTK
    
    :X86
    SET CCTKPath="x86"
    GOTO RunCCTK
    
    :RunCCTK
    ECHO --Running command
    %CCTKPath%\cctk.exe !ARG1! !ARG2! !ARG3!
    cscript.exe //nologo Show-CCTKErrors.vbs %errorlevel%
    GOTO END
    
    REM ---END MAIN LOOP---
    
    :PARSE_ARGV
    REM ref: http://skypher.com/index.php/2010/08/17/batch-command-line-arguments/
      SET PARSE_ARGV_ARG=[]
      SET PARSE_ARGV_END=FALSE
      SET PARSE_ARGV_INSIDE_QUOTES=FALSE
      SET /A ARGC = 0
      SET /A PARSE_ARGV_INDEX=1
      :PARSE_ARGV_LOOP
      CALL :PARSE_ARGV_CHAR !PARSE_ARGV_INDEX! "%%ARGV:~!PARSE_ARGV_INDEX!,1%%"
      IF ERRORLEVEL 1 (
        EXIT /B 1
      )
      IF !PARSE_ARGV_END! == TRUE (
        EXIT /B 0
      )
      SET /A PARSE_ARGV_INDEX=!PARSE_ARGV_INDEX! + 1
      GOTO :PARSE_ARGV_LOOP
    
      :PARSE_ARGV_CHAR
        IF ^%~2 == ^" (
          SET PARSE_ARGV_END=FALSE
          SET PARSE_ARGV_ARG=.%PARSE_ARGV_ARG:~1,-1%%~2.
          IF !PARSE_ARGV_INSIDE_QUOTES! == TRUE (
            SET PARSE_ARGV_INSIDE_QUOTES=FALSE
          ) ELSE (
            SET PARSE_ARGV_INSIDE_QUOTES=TRUE
          )
          EXIT /B 0
        )
        IF %2 == "" (
          IF !PARSE_ARGV_INSIDE_QUOTES! == TRUE (
            EXIT /B 1
          )
          SET PARSE_ARGV_END=TRUE
        ) ELSE IF NOT "%~2!PARSE_ARGV_INSIDE_QUOTES!" == " FALSE" (
          SET PARSE_ARGV_ARG=[%PARSE_ARGV_ARG:~1,-1%%~2]
          EXIT /B 0
        )
        IF NOT !PARSE_ARGV_INDEX! == 1 (
          SET /A ARGC = !ARGC! + 1
          SET ARG!ARGC!=%PARSE_ARGV_ARG:~1,-1%
          IF ^%PARSE_ARGV_ARG:~1,1% == ^" (
            SET ARG!ARGC!_=%PARSE_ARGV_ARG:~2,-2%
            SET ARG!ARGC!Q=%PARSE_ARGV_ARG:~1,-1%
          ) ELSE (
            SET ARG!ARGC!_=%PARSE_ARGV_ARG:~1,-1%
            SET ARG!ARGC!Q="%PARSE_ARGV_ARG:~1,-1%"
          )
          SET PARSE_ARGV_ARG=[]
          SET PARSE_ARGV_INSIDE_QUOTES=FALSE
        )
        EXIT /B 0
    
    :END
    ENDLOCAL
    
    EXIT /B %errorlevel%
  4. Create a package for your dell-cctk directory and files named ‘Dell CCTK Multi-Arch’, but don’t add a program.
  5. Create a file in \dell-cctk named HAPIInstall.cmd and add the following code.
    @echo off
    REM Determine Arch
    IF "%PROCESSOR_ARCHITECTURE%" == "AMD64" GOTO :X64
    GOTO X86
    
    :AMD64
    x64\hapi\hapint.exe -i -k C-C-T-K -p "hapint.exe"
    GOTO END
    
    :X86
    x86\hapi\hapint.exe -i -k C-C-T-K -p "hapint.exe"
    GOTO END
    
    :END
  6. Add a task sequence step in WinPE with the following characteristics. This enables use of CCTK in WinPE. If desired, this action and the next action can be placed in a group (folder) so that the conditional WMI queries only need to be specified once.
    Type: Run Command-Line
    Name: Install Dell HAPI Drivers
    Package: Dell CCTK Multi-Arch
    Command: HAPIInstall.cmd
    Conditions: If any of the following:
      * select * from win32_computersystem where Model like 'Latitude%'
      * select * from win32_computersystem where Model like 'Precision%'
      * select * from win32_computersystem where Model like 'Optiplex%'
    
  7. Add a task sequence step after the one created in Step 5 with the following characteristics. Substitute the command line arguments with whatever you’d like the action to do in the Dell BIOS.
    Type: Run Command-Line
    Name: Dell Bios - Enable TPM
    Package: Dell CCTK Multi-Arch
    Command: cctk.cmd --TPM=on --valsetuppwd=YourBiosPassword
    Conditions: If any of the following:
      * select * from win32_computersystem where Model like 'Latitude%'
      * select * from win32_computersystem where Model like 'Precision%'
      * select * from win32_computersystem where Model like 'Optiplex%'
    

Congrats! That should do ya. No more worrying about whether or not you selected the appropriate CCTK package for your architecture.

Advertisements

7 thoughts on “SCCM 2012 – Architecture Agnostic Dell CCTK WinPE Bios Package

  1. Pingback: SCCM 2012 – Generic Multi-Platform Dell CCTK BIOS Settings | windowsmasher

  2. Pingback: SCCM 2012 – Testing for Dell TPM Activation in a Task Sequence | windowsmasher

  3. Pingback: Table of Contents | windowsmasher

    • Peter, I place the Dell TS actions pretty early — before the driver installation steps while still in WinPE. This way I can set the SATA mode of the motherboard before the OS selects a driver.

  4. I’m trying to do exactly this in SCCM 2012 R2 with MDT 2013. We have a gooc number of varying Dell models here (about 7 Optiplex models and even more Latitude models). I’m using CCTK 2.2.1 and although the BIOS password gets set and TPM is turned on, the TPM is never activated. I’ve tried this multiple times without success. The relevant section of the TS looks something like this:

    – Install HAPI HAPI\Hapint64.exe -i -k C-C-T-K -p “hapint64.exe”
    – Set BIOS Password cctk.exe –setuppwd=BIOSPWD
    – Reboot
    – Install HAPI
    – Turn TPM On cctk.exe –tpm=on –valsetuppwd=BIOSPWD
    – Reboot
    – Install HAPI
    – Activate TPM cctk.exe –tpmactivation=activate –valsetuppwd=BIOSPWD
    – Reboot
    – Install HAPI
    – Remove BIOS Password cctk.exe –setuppwd= –valsetuppwd=BIOSPWD

    What’s crazy is that zticheckfortpm.wsf (http://blogs.technet.com/b/deploymentguys/archive/2010/12/22/check-to-see-if-the-tpm-is-enabled.aspx) sets the TPMEnabled & TPMActivated variables to True, but later when the process finishes, the drive isn’t encrypted and the BIOS shows that TPM was enabled but is still deactivated.

    I’m looking for some advice on how to troubleshoot this.

    • I skip the reboot between the TPM activation and TPM on it works for me so:
      – Set BIOS Password cctk.exe –setuppwd=BIOSPWD
      – Reboot
      – Install HAPI
      – Turn TPM On cctk.exe –tpm=on –valsetuppwd=BIOSPWD
      – Activate TPM cctk.exe –tpmactivation=activate –valsetuppwd=BIOSPWD

      I however keep the bios password which may be the largest difference.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s