Registry key delete issue

Not sure if I’m doing something wrong here or not, but here is what I have going on. I’m first trying to uninstall all old versions of Cisco Jabber via productCode & then if registry key’s get left behind remove the registry key’s that correspond with the old version. When I run the “registry key” removal piece in its own fixlet/task it works just fine, however when I run it as part of this fixlet I have setup it no longer works. Can anyone tell me if I’m simply missing something? Not understanding why it works one way & not the other. Below is the entire action script if needed.

//**Begin Preparation Marker
// Download all specified files
begin prefetch block
add prefetch item name=858D702CF2115462F074010216933E106051DA34 sha1=858d702cf2115462f074010216933e106051da34 size=56932864 url=SWDProtocol://127.0.0.1:52311/uploads/858D702CF2115462F074010216933E106051DA34/CiscoJabberSetup.msi.bfswd sha256=b7943476c86804c62fe879b1d5ea8cf7b0f2c065fe05f05ff2812e12aa47a18b
end prefetch block

// All SWD files will go into a folder in the clients __BESData folder. This folder gets cleared on every restart.
parameter “baseFolder” = “__Download/”
// Move files into subfolders and unescape file names
move “__Download/858D702CF2115462F074010216933E106051DA34” “{parameter “baseFolder”}CiscoJabberSetup.msi”

// Log setup
parameter “mainSWDLogFolder” = "{parent folder of client folder of current site}/__Global/SWDDeployData"
folder create "{parameter “mainSWDLogFolder”}"
parameter “logFile” = “SWD_DeploymentResults.log”

//**End Preparation Marker
delete __createfile
parameter “logFolder” = “{parameter “mainSWDLogFolder”}”
// Run setup process
delete run.bat

// Use .bat to set working directory to packages root, for setup command.
createfile until end
@ECHO OFF
cd "{parameter “baseFolder”}"
rem // See comments at the beginning of this action for an explanation of the comment markers.
set DATESTAMP=%DATE:~10,4%%DATE:~4,2%%DATE:~7,2%
set DATEANDTIME=%DATESTAMP% %time%
echo %DATEANDTIME% >> "{parameter “logFolder”}/{parameter “logFile”}"
echo Action ID: {id of active action} >> “{parameter “logFolder”}/{parameter “logFile”}”

// Removal of Old Versions
msiexec /x{{E40E5136-0E9B-4397-A723-8CF4BA09511F} /Q /lv C:\jabberUn913.txt
msiexec /x{{94DB202A-D7DA-4E49-B3AC-2B8C37A3B7DE} /Q /lv C:\jabberUn920.txt
msiexec /x{{1A969528-C04F-4B8E-B3B4-8EF51E781E19} /Q /lv C:\jabberUn960.txt
msiexec /x{{0705CE47-12C7-4B51-8585-C9463074B6CE} /Q /lv C:\jabberUn970.txt

delete __appendfile
delete temp.reg

appendfile REGEDIT4
action uses wow64 redirection false
appendfile [-HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Products\6315E04EB9E079347A32C84FAB9015F1]
appendfile [-HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Products\A202BD49AD7D94E43BCAB2C8733A7BED]
appendfile [-HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Products\825969A1F40CE8B43B4BE85FE187E191]
appendfile [-HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Products\74EC50707C2115B458589C6403476BEC]

move __appendfile temp.reg
wait regedit -s temp.reg

rem //**Begin Command Marker
echo Command: msiexec.exe /i “CiscoJabberSetup.msi” /qn reboot=REALLYSUPPRESS TYPE=CUP /lv C:\jabber1062-%COMPUTERNAME%.log >> "{parameter “logFolder”}/{parameter “logFile”}"
set errorlevel=
msiexec.exe /i “CiscoJabberSetup.msi” /qn reboot=REALLYSUPPRESS TYPE=CUP /lv C:\jabber1062-%COMPUTERNAME%.log >> “{parameter “logFolder”}/{parameter “logFile”}” 2>&1
set SWDExitCode=%errorlevel%
rem //**End Command Marker

echo Return code: %SWDExitCode% >> "{parameter “logFolder”}/{parameter “logFile”}"
echo. >> "{parameter “logFolder”}/{parameter “logFile”}"
exit %SWDExitCode%
end

move __createfile run.bat
// You will not be able to stop or take action on an applicable BigFix Client until your installer completes.
// So ensure no user input is required.
// If your package absolutely must interact with the user, replace ‘override wait’ with ‘override run’ and ‘wait’ with ‘run’.
override wait
hidden=true
completion=job
wait run.bat

//**Begin Closing Marker
// Get the return code of the previous action.
parameter “returnCode” = “{exit code of action}”

// Task will now exit.
exit {parameter “returnCode”}
//**End Closing Marker

you may need:

action uses wow64 redirection true

but you currently have:

action uses wow64 redirection false

Hmm I tried that without luck sadly. I did find out when trying to put in the following

// Removal of Old Versions
msiexec /x{{E40E5136-0E9B-4397-A723-8CF4BA09511F} /Q /lv C:\jabberUn913.txt
msiexec /x{{94DB202A-D7DA-4E49-B3AC-2B8C37A3B7DE} /Q /lv C:\jabberUn920.txt
msiexec /x{{1A969528-C04F-4B8E-B3B4-8EF51E781E19} /Q /lv C:\jabberUn960.txt
msiexec /x{{0705CE47-12C7-4B51-8585-C9463074B6CE} /Q /lv C:\jabberUn970.txt

as part of the “individual” fixlet that works I proceed to get a “Unable to parse action script/Unknown action command” error message. The second this section/chunk is removed it’ll allow/accept/correctly render my action script. Not sure if this helps at all?

It is hard to tell what is going on with your actionscript unless you put it in a preformatted block by editing your post, selecting the actionscript, then clicking the “</>” button.

If those msiexec commands are not being run in a BAT file, then they need wait in front of each of them.

I think you have a mix of commands and actionscript in a BAT file, which won’t work. You have to run the actionscript separately from what runs in the BAT file.

1 Like

You are ending your createfile far too late. Right now, all of this is included within the __creatfile:

    createfile until end
@ECHO OFF
cd "{parameter "baseFolder"}"
rem // See comments at the beginning of this action for an explanation of the comment markers.
set DATESTAMP=%DATE:~10,4%%DATE:~4,2%%DATE:~7,2%
set DATEANDTIME=%DATESTAMP% %time%
echo %DATEANDTIME% >> "{parameter "logFolder"}/{parameter "logFile"}"
echo Action ID: {id of active action} >> "{parameter "logFolder"}/{parameter "logFile"}"

// Removal of Old Versions
msiexec /x{{E40E5136-0E9B-4397-A723-8CF4BA09511F} /Q /lv C:\jabberUn913.txt
msiexec /x{{94DB202A-D7DA-4E49-B3AC-2B8C37A3B7DE} /Q /lv C:\jabberUn920.txt
msiexec /x{{1A969528-C04F-4B8E-B3B4-8EF51E781E19} /Q /lv C:\jabberUn960.txt
msiexec /x{{0705CE47-12C7-4B51-8585-C9463074B6CE} /Q /lv C:\jabberUn970.txt

delete __appendfile
delete temp.reg

appendfile REGEDIT4
action uses wow64 redirection false
appendfile [-HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Products\6315E04EB9E079347A32C84FAB9015F1]
appendfile [-HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Products\A202BD49AD7D94E43BCAB2C8733A7BED]
appendfile [-HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Products\825969A1F40CE8B43B4BE85FE187E191]
appendfile [-HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Products\74EC50707C2115B458589C6403476BEC]

move __appendfile temp.reg
wait regedit -s temp.reg

rem //**Begin Command Marker
echo Command: msiexec.exe /i "CiscoJabberSetup.msi" /qn reboot=REALLYSUPPRESS TYPE=CUP /lv C:\jabber1062-%COMPUTERNAME%.log >> "{parameter "logFolder"}/{parameter "logFile"}"
set errorlevel=
msiexec.exe /i "CiscoJabberSetup.msi" /qn reboot=REALLYSUPPRESS TYPE=CUP /lv C:\jabber1062-%COMPUTERNAME%.log >> "{parameter "logFolder"}/{parameter "logFile"}" 2>&1
set SWDExitCode=%errorlevel%
rem //**End Command Marker

echo Return code: %SWDExitCode% >> "{parameter "logFolder"}/{parameter "logFile"}"
echo. >> "{parameter "logFolder"}/{parameter "logFile"}"
exit %SWDExitCode%
  end

Right now, your __appendfile doesn’t exist; all of the ActionScript statements that you intended to build the __appendfile, have actually ended up in the text of the __createfile.

My advice would be to split your appendfile and createfile into blocks to make it more clear what’s happening. Decide on a pattern and do nothing but file content in each block, terminating each as early as possible, i.e.

delete __createfile
createfile until EOF
line1
line2
EOF
delete TargetFile.cmd
move __createfile TargetFile.cmd

delete __appendfile
appendfile line1
appendfile line2
delete TargetFile2.cmd
move __appendfile TargetFile2.cmd
1 Like

Unrelated to your creatfile / appendfile dilemma, you’re going to have a problem in trying to evaluate %ERRORLEVEL%. You aren’t keeping a counter anywhere in the batch file, so the resulting %ERRORLEVEL% will only be the return code of the last statement in the batch file, without regard for whether any earlier statement succeeded or failed.

Also, because you aren’t checking for the existence of any of the products before you try to remove them, you’ll receive an error for any that aren’t installed - likely error 1603.

If you check here or at http://bigfix.me, you should be able to find any number of Uninstall fixlets to use as a guide for dynamically removing Jabber instances, regardless of their product code. I don’t know what the DisplayName of the Jabber products are, but let’s just suposed they include the text “Jabber”. Then you might be able to do something like

    action uses wow64 redirection false
delete __createfile
createfile until EOF

{concatenation "%0d%0a" of ("start /wait %22%22 msiexec.exe /x" & it & " /qn ALLUSERS=1 REBOOT=ReallSuppress") of (names of keys whose (value "DisplayName" of it as string contains "Jabber") of keys "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall" of (x32 registries;x64 registries))}

EOF
delete RemoveJabber.cmd
move __createfile RemoveJabber.cmd
waithidden cmd /c RemoveJabber.cmd

I like to use the start /wait "" to ensure the script waits for the msiexec.exe to finish, and to start the new shell with no window title.

1 Like

One last thing - I’d strongly recommend against delete keys beneath HKLM\Software\Classes\Installer\Products directly. You’re going to end up with a mess where Products won’t install, won’t upgrade, won’t patch, or won’t uninstall when those keys no longer match what’s actually installed on the system.

1 Like

Thanks so much for the advice everyone. Jason takes the cake with the createfile/appendfile issue, this fixed the problem. Good to know in regards to dynamically removing Jabber, thanks again!

1 Like

@JasonWalker did a much better job spelling it all out well, but the createfile/appendfile issues is what I was getting at here:

1 Like