Package to run batch file as Administrator: Command Prompt RRS feed

  • Question

  • Hi,

    on SCCM 1906, we've published a Package with a batch file (uninstall.cmd) in Software Center.  The published Package runs the batch file.  We've configured the Package to run the batch file run in a normal visible command prompt window (we see it run), but it doesn't proceed with taking any actions, since it doesn't appear to have permissions.  The uninstall.cmd batch file does work when run manually.  In the Package, we've selected "Run with administrative rights".  Are we missing a setting or should the command line in the package be different?  Currently the command line in the Package is "uninstall.cmd"


    • Edited by APang.F1 Thursday, July 9, 2020 5:04 PM
    Thursday, July 9, 2020 5:03 PM

All replies

  • Without knowing what is in your batch file, nothing can be said here.

    If you can view the execution of the batch, adding some pauses to it may help you troubleshoot .

    Jason | https://home.configmgrftw.com | @jasonsandys

    Thursday, July 9, 2020 5:31 PM
  • Our batch file consists of a series of msiexec uninstall commands with the GUID of our software.  We can tell that it's uninstalling when the batch file pauses at one of the uninstall lines.


    msiexec.exe /x {………………….}

    Thursday, July 9, 2020 5:46 PM
  • OK, so what's not working?

    Have you reviewed the Application event log as all Windows Installer operations are logged there?

    Jason | https://home.configmgrftw.com | @jasonsandys

    Thursday, July 9, 2020 6:02 PM
  • We'll modify the command line in our Package to pipe the batch file output to a text file, so that we can see any errors.


    Thursday, July 9, 2020 6:20 PM
  • Our batch file does do a REG QUERY for each GUID to determine whether the key exists (there are a few hundred GUIDs in the batch file).  Perhaps the REG QUERY requires an elevated command prompt?

    The batch file window that we've made visible doesn't show as being an elevated command prompt window.

    (no related errors in the event logs)

    Thursday, July 9, 2020 11:12 PM
  • Perhaps the REG QUERY requires an elevated command prompt?

    Generally no, but that depends on the permissions of what you are querying. However, running as the local System account generally gives access to everything so I doubt this is a permissions issue.

    no related errors in the event logs

    If you are seeing nothing in the Application event logs for Windows Installer, then none of your msiexec command-lines are being called.

    Have you accounted for difference between the 64-bit registry and 32-bit registry since packages in ConfigMgr run in a 32-bit context?

    Jason | https://home.configmgrftw.com | @jasonsandys

    Thursday, July 9, 2020 11:44 PM
  • The REG QUERY wasn't effective running in the batch file funning as local System, but running only the msiexec.exe /x {………………….} command works fine.

    Monday, July 13, 2020 10:04 PM
  • As noted, have you accounted for and handled 32-bit vs. 64-bit registry locations?

    Jason | https://home.configmgrftw.com | @jasonsandys

    Monday, July 13, 2020 11:13 PM