/build/static/layout/Breadcrumb_cap_w.png

K1000 batch file doesn't work as K2000 post-install task?

I've got a batch file that runs perfectly as a script in K1000. It uninstalls 2 pieces of software, removes desktop icons, Start Menu entries, and Add/Remove Programs entries (the software installer itself doesn't do all those things, dur).

When this batch file is attempted as a post-install task on a K-Image via K2000, it seems to fail to run. I've tried it as a post-install batch file, and have tried zipping it and "call myuninstaller.bat" as an Application post-install task -- it just seems to get skipped over as a post-installation task when imaging.

This problem is not a show-stopper -- I'll get this done another way -- but it makes me worry that I am not fully understanding what K2000 wants out of batch files. Any advice? Thank you in advance!

Here's the text of the script -- again, works as a K1000 script but not as a K2000 batch post-install task:
set _inst=%SystemDrive%\Millennium\UninstallerData\Uninstall Innovative Millennium.exe
set _lnk=Innovative Millennium.lnk
"%_inst%" -silent
if exist "%Public%\Desktop\%_lnk%" del /f /q "%Public%\Desktop\%_lnk%"
set _insto=%SystemDrive%\Millennium\Offline\UninstallerData\Uninstall Innovative Millennium Offline Circulation.exe
set _lnko=Millennium Offline Circulation.lnk
"%_insto%" -i silent
if exist "%Public%\Desktop\%_lnko%" del /f /q "%Public%\Desktop\%_lnko%"
rmdir /s /q "%ProgramData%\Microsoft\Windows\Start Menu\Programs\Innovative Millennium"
rmdir /s /q "%HOMEDRIVE%\Millennium"
set "RegKey=HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Innovative Millennium"
reg delete "%RegKey%" /f

0 Comments   [ + ] Show comments

Answers (2)

Answer Summary:
Posted by: SMal.tmcc 9 years ago
Red Belt
2

Top Answer

Your problem is most likely a sequencing problem.  The first uninstall is probably still running when the next kicks off and also the removes and deletes could also be in the running mix.  Try it this way  the last four lines will not execute till the reg delete runs and finishes so the other two uninstalls should no longer referencing anything in those directories either.

set _inst=%SystemDrive%\Millennium\UninstallerData\Uninstall Innovative Millennium.exe
set _lnk=Innovative Millennium.lnk
set _insto=%SystemDrive%\Millennium\Offline\UninstallerData\Uninstall Innovative Millennium Offline Circulation.exe
set _lnko=Millennium Offline Circulation.lnk
set RegKey=HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Innovative Millennium

start /wait "%_inst%" -silent

start /wait "%_insto%" -i silent

start /wait reg delete "%RegKey%" /f

if exist "%Public%\Desktop\%_lnk%" del /f /q "%Public%\Desktop\%_lnk%"
if exist "%Public%\Desktop\%_lnko%" del /f /q "%Public%\Desktop\%_lnko%"
rmdir /s /q "%ProgramData%\Microsoft\Windows\Start Menu\Programs\Innovative Millennium"
rmdir /s /q "%HOMEDRIVE%\Millennium"


Comments:
  • also your set regkey line had the double quotes in the wrong place - SMal.tmcc 9 years ago
    • SMal.tmcc, thank you! You are correct that start /wait was needed. (Not sure why it is necessary as a postinstall when imaging and not as a standalone script, but on the other hand it does appear tidier and more elegant...)

      So far, I've run it as the very last postinstall task so I can see any errors it may be trying to communicate (don't yet have the skill for further debugging). Everything is pretty much working as expected, though a notice pops up mentioning "Windows cannot find -silent" (but the task still completes). Frankly, I count that as "close enough" though I may try a few more tweaks.

      Thank you! - agibbons 9 years ago
      • most likely this line is causing the error. start /wait "%_insto%" -i silent. it is seeing the -i as a switch and silent as an unknown option for that switch. - SMal.tmcc 9 years ago
      • the k2000 is mainly an imaging appliance where the k1000 is more of a management appliance and the internal code is very different. The k1000 engineers have worked at correcting things like this automatically for the tech where the k2000 engineers main focus is on multiple OS imaging and scripting. - SMal.tmcc 9 years ago
      • I agree re: -i silent...will try other options. And, makes sense re: K2000/K1000 difference. Thanks! - agibbons 9 years ago
Posted by: EdT 9 years ago
Red Belt
0
Have you tried adding a few lines of debug code that pipe the value of the different variables you use to a text file?  That will give you at least an idea if the code is resolving correctly.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ