/build/static/layout/Breadcrumb_cap_w.png

Why are some of my DOS commands failing via scripting when they work via a local command line on the target computer?

I have written a script to remove Adobe Acrobat DC and Adobe Creative Cloud from computers specified.  This script has 10 tasks.  The first 9 are for displaying messages and forcibly closing all Microsoft Office applications as required for uninstalling many Adobe products.  The first 9 are working perfectly.  The 10th task is as follows:

  1. Launch SYS\cmd.exe with params /C msiexec /x {AC76BA86-1033-FFFF-7760-0C0F074E4100} /qn.
    trashcan-icon.png
  2. Launch SYS\cmd.exe with params /C start /w ”“ ”C:\Program Files (x86)\Adobe\Adobe Creative Cloud\Utils\Creative Cloud Uninstaller.exe“ -uninstall.
    trashcan-icon.png
  3. Launch SYS\cmd.exe with params /C reg delete HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{E16C6CD6-B8ED-4D71-ADD8-59BF71D41304} /f.
    trashcan-icon.png
  4. Launch SYS\cmd.exe with params /C C:\Program Files (x86)\Quest\KACE\runkbot.exe 4 0.
    trashcan-icon.png
  5. Destroy the message window named Software removal starting.
    trashcan-icon.png
  6. Create a message window named Success with title Software removal successful, message Adobe Creative Cloud and Adobe Acrobat Reader DC have successfully been removed. You may now reopen Microsoft Office applications. and timeout 3600 seconds.

Steps 1 and 4 work perfectly.  Steps 2 and 3 both fail.  All of these steps work went entered manually into an administrative command line on the target computer.  Step 5 and 6 should not be relevant.  Step 2 displays a visible error window on the target computer with the message "Windows cannot find '""'. Make sure you typed the name correctly, and then try again.".  My output log is as follows:

Running as SYSTEM
Couldn't kill process (fail) : OUTLOOK.EXE
Couldn't kill process (fail) : WINWORD.EXE
Couldn't kill process (fail) : EXCEL.EXE
Couldn't kill process (fail) : POWERPNT.EXE
Couldn't kill process (fail) : MSACCESS.EXE
Couldn't kill process (fail) : MSPUB.EXE
Couldn't kill process (fail) : onenoteim.exe
Killed Process : OfficeClickToRun.exe (success)
Launched Process: cmd.exe
Creating process returned non-zero: C:\WINDOWS\System32\cmd.exe /C start /w ”“ ”C:\Program Files (x86)\Adobe\Adobe Creative Cloud\Utils\Creative Cloud Uninstaller.exe“ -uninstall: (0) The operation completed successfully.
Error Code: 0
Status Code: 1

I'm confused as to why it says that the operation completed successfully.  It halted the script so it must not have and it certainly didn't uninstall Adobe Creative Cloud from the computer.  Lets remove steps 1 and 2 from the script so we can see what happens when step 3 is able to run.  This will be tested on a computer where step 1 and 2 have already completed successfully, step 2 having been ran manually via a local command line on the target computer.  Here's the log:

Running as SYSTEM
Couldn't kill process (fail) : OUTLOOK.EXE
Couldn't kill process (fail) : WINWORD.EXE
Couldn't kill process (fail) : EXCEL.EXE
Couldn't kill process (fail) : POWERPNT.EXE
Couldn't kill process (fail) : MSACCESS.EXE
Couldn't kill process (fail) : MSPUB.EXE
Couldn't kill process (fail) : onenoteim.exe
Killed Process : OfficeClickToRun.exe (success)
Creating process returned non-zero: C:\WINDOWS\System32\cmd.exe /C reg delete HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{E16C6CD6-B8ED-4D71-ADD8-59BF71D41304} /f: (0) The operation completed successfully.
Error Code: 0
Status Code: 1

Again it says that the operation completed successfully but the script was halted and the registry entry still exists.  Step 4 I won't show; it's working successfully in my installation script for these products so I assume it will also work in this script when the script is not halted.


0 Comments   [ + ] Show comments

Answers (2)

Posted by: KevinG 4 years ago
Red Belt
0
Running as SYSTEM


Running as System is not the same as running a program under a local account like the Administrator account from the command line.

Here is an article that talks about how to use pstool.exe to run as Local System so you can test the behavior of your script using the System Account.

https://specopssoft.com/blog/how-to-become-the-local-system-account-with-psexec/


If you create an Online script and Select Windows under "Operating Systems:" you can run the script using the Administrator or some other account credentials.


You will want to remove C:\Program Files (x86)\Quest\KACE\runkbot.exe 4 0 from your script as this is not recommended.  This can cause performance issues with the appliance.


Comments:
  • I tried running the commands which fail through scripting, as the system, locally via a command prompt, using your instructions. Both commands ran successfully so this does not appear to be the problem. - Nolan_Evans 4 years ago
Posted by: chucksteel 4 years ago
Red Belt
0

The SMA Agent runs in the 32bit environment so you need to add the /reg:64 flag to your reg delete command. 

For the Adobe uninstaller I would call it directly instead of invoking with cmd. I'm also not sure that your quotes are all correct in the command, which is why running the uninstaller directly would simplify things. The log says the operation completed successfully because it launched cmd, what happens inside of the cmd isn't necessarily relevant to the agent. You told it to run cmd and told cmd to run a command. If that command failed the error doesn't mean cmd didn't run.


Comments:
  • Thank you for the correction with reg delete command; it fixed the problem.

    I discovered the uninstall command when searching for a way to silently uninstall Adobe Creative Cloud. In this search I could not discover another mechanism for silent removal. It appeared that many other people also discovered this and were frustrated by it. I'm therefore unsure of how it would be possible to directly run the uninstaller silently. I also thought that the quotes might not be correct given the error message but I'm unsure of what to change. I've tried a few different variations but couldn't find any that would work in either KACE or a local command line aside from the one listed above which only works via command line. - Nolan_Evans 4 years ago
    • The CC Cleaner Tool is the best method:
      https://helpx.adobe.com/creative-cloud/kb/cc-cleaner-tool-installation-problems.html - chucksteel 4 years ago
 
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