Start a Conversation

Unsolved

S

3 Posts

2273

April 23rd, 2019 06:00

CCTK -i - Input File not found when running in a task sequence

Hi,

First of all I should say my scripting knowledge is limited but I generally know enough to understand what others have written and debug etc.  I've been using the article at https://www.vacuumbreather.com/index.php/blog/item/78-automating-dell-bios-configuration-using-mdt to use CCTK to deploy a settings.cctk file via Powershell in MDT. This works great on a test machine with the files present locally in the $PSScriptRoot. However, it appears that when running the powershell script from MDT the input file cannot be found or if it can it causes the TS to hang.  The relevant bit of the code is:

$cmdLine  = ' -i Settings.cctk --valsetuppwd=' + $PasswordAsString

$log_tmp = Execute-Command -commandTitle "Importing BIOS setting from Settings file" -commandPath  $PSScriptRoot\cctk.exe -commandArguments $cmdLine
Write-Host $log_tmp

The settings.cctk file resides in the same location as the script and the cctk.exe (and other cctk files).  I am using Command | Configure 4.1.0.478.  I have tried all sorts of variants of explicitly specifying the file path to the Deployment share on the MDT server and I have also copied all the CCTK files (including the settings file) into the winPE image and tried referencing the location of the settings file on x:\ within the powershell script as an alternative. 

Generally one of two things happen; either the above part of the script returns that it can't find the file and exits and the TS continues or the TS gets stuck in that it looks to be deploying based on the progress bar in MDT but nothing further happens. This latter event tends to happen when specifying the winPE file path to the settings file in quotes. As the script never completes, there is no logging to determine what the issue is.

It's not very clear to me whether the settings file needs to be on the local machine in the winPE environment (e.g. x:\CCTK_x64\settings.cctk) or should be able to be referenced from the same network location as the other cctk files.  I've not been able to find any useful examples of the syntax for specifying an input file for cctk -i in a WinPE environment.

There seems to be lots of advice of how to deploy individual settings via CCTK and cmd but very little about using an input file and part of the reason for using the script is to be able to use AES-256 encryption for the password.

I was wondering if anyone had experience of trying to deploy a CCTK settings file via Powershell in an MDT task sequence. Feels like it should be doable but I've been struggling with this for days, so any help appreciated. The full sanitised script is below.

<#
.Synopsis
    Apply Dell firmware settings
.DESCRIPTION
    Installs Dell Inc. HAPI64 drivers and configures Dell Inc. BIOS settings
.EXAMPLE
    ConfigureDellBiosSettings.ps1
.NOTES
    Created:	 2018-05-16
    Version:	 1.0
    Author - Anton Romanyuk
    Twitter: @admiraltolwyn
    Blog   : http://www.vacuumbreather.com
    Disclaimer:
    This script is provided 'AS IS' with no warranties, confers no rights and 
    is not supported by the author.
.LINK
    http://www.vacuumbreather.com
 
************************************************************************************************************************
 
#>

# Determine where to do the logging 
$tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment 
$logPath = $tsenv.Value("LogPath") 
$logFile = "$logPath\$($myInvocation.MyCommand).log"
 
# Start the logging 
Start-Transcript $logFile
Write-Host "Logging to $logFile"
 
# Start Main Code Here
# https://stackoverflow.com/questions/8761888/capturing-standard-out-and-error-with-start-process
Function Execute-Command ($commandTitle, $commandPath, $commandArguments)
{
    $pinfo = New-Object System.Diagnostics.ProcessStartInfo
    $pinfo.FileName = $commandPath
    $pinfo.RedirectStandardError = $true
    $pinfo.RedirectStandardOutput = $true
    $pinfo.UseShellExecute = $false
    $pinfo.Arguments = $commandArguments
    $p = New-Object System.Diagnostics.Process
    $p.StartInfo = $pinfo
    $p.Start() | Out-Null
    $p.WaitForExit()
    [pscustomobject]@{
        commandTitle = $commandTitle
        stdout = $p.StandardOutput.ReadToEnd()
        stderr = $p.StandardError.ReadToEnd()
        ExitCode = $p.ExitCode  
    }
}

Write-Host "$($myInvocation.MyCommand) - Importing default BIOS settings"
$cmdLine  = ' -i -k C-C-T-K -p "hapint64.exe" -q'
Write-Host "$($myInvocation.MyCommand) - Installing Dell HAPI Drivers"
Write-Host "Argument list set to $cmdLine"

$log_tmp = Execute-Command -commandTitle "Installing Dell HAPI Drivers" -commandPath  $PSScriptRoot\hapi\hapint64.exe -commandArguments $cmdLine
Write-Host $log_tmp

#Write-Host "$($myInvocation.MyCommand) - Importing BIOS setting from Settings files"

#Decrypt AES 256-bit Encrypted BIOS Password

 
  
# Define variables for BIOS Password

  
    # Read the secure password from a password file and decrypt it to a variable
   
#Clear BIOS Password for testing purposes $cmdLine = ' --setuppwd= --valsetuppwd='+ $PasswordAsString $log_tmp = Execute-Command -commandTitle "Clearing BIOS password" -commandPath $PSScriptRoot\cctk.exe -commandArguments $cmdLine Write-Host $log_tmp #Set Admin Password $cmdLine = ' --setuppwd='+ $PasswordAsString $log_tmp = Execute-Command -commandTitle "Setting BIOS password" -commandPath $PSScriptRoot\cctk.exe -commandArguments $cmdLine Write-Host $log_tmp $cmdLine = ' -i Settings.cctk --valsetuppwd=' + $PasswordAsString $log_tmp = Execute-Command -commandTitle "Importing BIOS setting from Settings file" -commandPath $PSScriptRoot\cctk.exe -commandArguments $cmdLine Write-Host $log_tmp #Stop-Process -Name cmd -Force Write-Host "$($myInvocation.MyCommand) - Import finished" # Stop logging Stop-Transcript

3 Posts

April 25th, 2019 00:00

After much hair-pulling, I established it was nothing to do with the file path of the settings file. In the end, I created a new multiplatform package which appears to have resolved the issue. The hanging appears to have been due to cttk being unable to handle a setting in the CCTK file that was originally derived from my machine.
No Events found!

Top