SCCM Application Deployment failing due to blank batch file in ccmcache folder

0

I've created an application in SCCM to deploy the latest SMART Learning Suite, but the clients are retaining the product key from the previously installed version. To solve this, I've created an additional deployment type (Script) with priority 2 and set it as a dependency of the main MSI deployment type. This script removes the previous product key and creates a text file which is then used to detect if the deployment type is installed.

I.e. Deployment Types as follows and the MSI depends on the Script

Priority    Name                               Type
--------    -----                              -----
1           SMART Education Software           MSI
2           Remove SMART 14 Product Key        Script

The detection method of the second deployment type above is this VBScript which appears to be working fine:

Set fso = CreateObject("Scripting.FileSystemObject")
Set oShell = CreateObject( "WScript.Shell" )

pf=oShell.ExpandEnvironmentStrings("%ProgramFiles(x86)%")
notebook=pf & "\SMART Technologies\Education Software\Notebook.exe"
detectionFile=pf & "\SMART Technologies\Education Software\SCCM_SMART14ProductKeyRemoved.txt"

If fso.FileExists(notebook) Then
    If fso.FileExists(detectionFile) Then
       WScript.Quit(0)
    End If
Else
   WScript.Quit(0)
End If

The Installation program of the second deployment type is set to "RemoveSMART14ProductKey.bat" which is in the same content location as the installation files for the SMART software. The contents of that batch file are:

@echo off
if exist "%ProgramFiles(x86)%\Common Files\SMART Technologies\SMART Activation Wizard\activationwizard.exe" (
    "%ProgramFiles(x86)%\Common Files\SMART Technologies\SMART Activation Wizard\activationwizard.exe" --puid=notebook_14 --m=4 --v=5 --return --pks="MY PRODUCT KEY"
)
if exist "%ProgramFiles(x86)%\Common Files\SMART Technologies\SMART Product Update\activationwizard.exe" (
    "%ProgramFiles(x86)%\Common Files\SMART Technologies\SMART Product Update\activationwizard.exe" --puid=notebook_14 --m=4 --v=5 --return --pks="MY PRODUCT KEY"
)

if exist "%ProgramFiles(x86)%\SMART Technologies\Education Software" (
    echo. 2>"%ProgramFiles(x86)%\SMART Technologies\Education Software\SCCM_SMART14ProductKeyRemoved.txt"
)

The Problem

The application is being correctly detected as Current State = NotInstalledbut when I try to install the application, it fails with the error 0x800700c1. The following is copied from the AppEnforce.log file using cmtrace.exe so it's easier to read:

+++ Application not discovered with script detection. [AppDT Id: ScopeId_D8B9BC49-56F0-497D-821B-150740B9AB49/DeploymentType_93c23da4-3164-4528-880e-dc2385d72422, Revision: 8] AppEnforce  28/11/2020 17:51:59 12780 (0x31EC)
App enforcement environment: 
Context: Machine
Command line: "RemoveSMART14ProductKey.bat"
Allow user interaction: No
UI mode: 0
User token: null
Session Id: 2
Content path: C:\Windows\ccmcache\8
Working directory:  AppEnforce  28/11/2020 17:51:59 12780 (0x31EC)
Prepared working directory: C:\Windows\ccmcache\8   AppEnforce  28/11/2020 17:51:59 12780 (0x31EC)
Prepared command line: "C:\Windows\ccmcache\8\RemoveSMART14ProductKey.bat"  AppEnforce  28/11/2020 17:51:59 12780 (0x31EC)
Executing Command line: "C:\Windows\ccmcache\8\RemoveSMART14ProductKey.bat" with user context   AppEnforce  28/11/2020 17:51:59 12780 (0x31EC)
Working directory C:\Windows\ccmcache\8 AppEnforce  28/11/2020 17:51:59 12780 (0x31EC)
ScriptHandler::EnforceApp failed (0x800700c1).  AppEnforce  28/11/2020 17:51:59 12780 (0x31EC)
AppProvider::EnforceApp - Failed to invoke EnforceApp on Application handler(0x800700c1).   AppEnforce  28/11/2020 17:51:59 12780 (0x31EC)
CommenceEnforcement failed with error 0x800700c1.   AppEnforce  28/11/2020 17:51:59 12780 (0x31EC)
Method CommenceEnforcement failed with error code 800700C1  AppEnforce  28/11/2020 17:51:59 12780 (0x31EC)
++++++ Failed to enforce app. Error 0x800700c1. ++++++  AppEnforce  28/11/2020 17:51:59 12780 (0x31EC)

When I look at C:\Windows\ccmcache\8\RemoveSMART14ProductKey.bat, the file is completely empty. The rest of the installation files for the MSI deployment type are all there, but this script is the only file with no content. I've checked the permissions of the file on the server and it's set to inherit just like the others, so as you would expect the permissions are identical on the MSI file etc.

I'm assuming the error is because it's trying to execute an empty script? I just can't figure out why it's empty.

windows-server-2016
windows-10
sccm
asked on Server Fault Nov 28, 2020 by Daniel

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0