Quantcast
Channel: Configuration Manager 2007 Software Distribution forum
Viewing all articles
Browse latest Browse all 629

[SOLVED] Errors Executing Batch Files for Post Application Installation Configuations

$
0
0

I'm super new to SCCM - still trying to figure a lot of things out.


Nearly all of our applications have post installation steps like applying a registry configuration (via either `regedit /s` or `reg add`), creating directories, copying files (license file, configuration file) and so on.  Since I've already created a bunch of applications, leveraging SCCM's nifty little feature that grabs all the app info from the MSIs, I'm now looking for how to accomplish 'the next step': applying the proper configurations.

I realize there are a variety of ways to accomplish this, but, one method I've seen time & time again is to create the application via the MSI, and then afterward change the command line to whatever script I want to run; which does the installation plus the extra actions.

Here's the process I've been following that's resulting in errors in SCCM but *not* in the script [read: batch file] I'm calling:

  1. Build the batch file that calls the installer and does the post installation configuration:
    1. Calls setup file (actual MSI or setup.exe etc) via relative path and any necessary parameters/arguments etc: "%~dp0Full_Installer\setup.exe" /S /v"/qb SERIALNUMBER=12345 /l*vx c:\Logs\ApplicationName.log"

    2. Performs a variety of operations: xcopy /r /ymd/mkdirreg add/deleteregedit /s; Each operation is redirected to >>!logfile! 2>>&1

  2. Test each batch file the follow this process:
    1. confirm no errors on screen during install
    2. confirm no errors in logs after install
    3. confirm application successfully installed, which means:
      1. checking the location of where the app is expected to install to verify its there and it works
      2. checking that all applicable changes were made successfully
        1. so I'm looking for registry entries, configuration files, directory creation etc - everything in the batch
      3. checking Programs and Features to validate its presence
  3. I repeat this process (all of Step 2 above) for the uninstall batch file to confirm it too completes successfully

With the batch files tested & confirmed working

  1. I create new Application in SCCM
  2. Select Windows Installer (*.msi file)
  3. Choose msi file from \\unc\path\application\fullinstaller\file.msi
  4. Make any necessary adjustments to the General information screen
  5. Close Application Wizard
  6. Edit Properties of newly created Application
  7. Go to Deployment Types tab
  8. Select the MSI entry in there & click Edit
  9. Go to the Content tab & alter directory
    1. During creation its pointed to \\unc\path\application\fullinstaller\file.msi
    2. While not always the case, the batch file actually lives one directory up in \\unc\path\application, so I'm adjusting it to point to that directory. instead
  10. Go to Programs tab
  11. Change Installation program to the batch file: install_myapp.cmd
  12. Change Uninstall program to the batch file: uninstall_myapp.cmd
  13. Click Apply & click OK

Ok, now that all my changes are made, I need to get this into the DP:

  1. I Deploy Content (if I haven't already done so)
    1. Right click on Application > Distribute Content > Add DP > Continue through Wizard
  2. Redistribute Content (especially if edits were made to existing applications)
    1. Right click on Application > Properties > content Locations > Select location > Click Redistribute
  3. Verify deployment/redistribution via Content Status > View Status
  4. Wait a little while (usually just a few minutes <5)

With that now complete, I'm ready to test the install/uninstalls via SCCM.  So I go to client workstation, load up Software Center & Locate application & click 'Install', and this is where things get strange.

  • Misreported Failure
  1. It successfully downloads but installation fails with a variety of errors (see below):
    1. Unable to make changes to your software.
      There was a problem applying changes to the software.  You can try again.  Or, if the problem continues, the information that is shown in the following section can assist your help desk in troubleshooting.
      Click OK to return to Software Center
      More Information
      The software change returned error code 0xVARIES(n).
  2. I check "Program Files (x86)" and I see the program installation directory & its populated with files.
  3. I check "Programs and Features" and I see the application listed.  I can uninstall, change & repair.
  4. I restart software center, refresh it a few times and the application is still listed under 'Available Software' and 'Installation Status'.
  5. If I click 'Retry' it immediately disappears from view
    1. What that means is: If I'm looking at 'Available Software' or 'Installation Status', the application vanishes from that 'tab', and appears under 'Installed Software' within 'Software Center'
  6. I reviewed the MSI manually but saw no "return value 3" entries; Passed the same log through WiLogUtil.exe and its not isn't showing any problems either.

So it actually did install successfully, yet something 'failed', or was translated as a failure, causing Software Center to believe the install failed.

  • Outright Failure
  1. With application 'X' installed, from the 'Installed Software' tab I click 'Uninstall' and like before I get an error:
    1. Unable to make changes to your software.
      There was a problem applying changes to the software.  You can try again.  Or, if the problem continues, the information that is shown in the following section can assist your help desk in troubleshooting.
      Click OK to return to Software Center
      More Information
      The software change returned error code 0xVARIES(n).
  2. I check "Program Files (x86)" and the other tasks - its still installed and everything is still in place.
  3. I don't create uninstall log files so I don't have anything to view, but again: running the uninstall batch file manually results in success.

I'm quite perplexed!

As I mentioned above, the install & uninstall errors vary:

  • The software change returned error code 0x1(1).
  • The software change returned error code 0x4(4).
  • The software change returned error code 0xFF(255).
  • The software change returned error code 0x87D00213(-2016411117).
  • The software change returned error code 0x87D00325(-2016410843).
  • The software change returned error code 0x87D01107(-2016407289).

Running the batch file to install/uninstall completes without error so either something unexpected is happening that SCCM interprets as an error, or, I made a mistake in the way I created the application.  I want to believe its something very simple that I'm missing or just not doing right.

When installing/uninstalling applications via Software Center, I'm looking at task manager to view the actual command line being run for the install, and in some situations, its incorrect.  In other situations the command line is correct, but, the actual install batch file (in c:\windows\ccmcache\random) is not the most recent one and/or its missing additional files that were recently added.


Perhaps this is the source of all my problems: The DP is not up to date/doesn't contain the latest changes made to the batch files.  (Because remember, as I mentioned above, the install/uninstall batch files currently work without issue when executed manually or in our current deployments.)

 

So maybe my question should be: If the below isn't the proper method for 'refreshing' the DP with the latest application data (updates to the install package, updated files etc), what is the proper method for doing so?

  1. Right click on Application > Deploy Content  & complete wizard (if I haven't already done so)
  2. Right click on Application > Properties > Content Locations > Select location > Click Redistribute > Click OK

Lastly, I'm a big log person.  All the batches log each operation and redirects the results (1> and 2>) to a log file for review.  It makes it super simple to see where something failed down the road.  SCCM includes a wealth of log files for various operations, and, in my humble opinion, its great but a bit overwhelming!

I know that the client logs are all stored in C:\Windows\CCM\Logs but there are over 100 logs in there and its not inherently obvious which log corresponds to which component or action of CM.  So, all that said, I'm happy to comb through with cmtrace to troubleshoot deeper & get a better understanding of the process, but I'm in need of help finding a good place to start.

  • Is there a resource available that provides a breakdown/definition of each of the logs in C:\Windows\CCM\Logs?
  • Is there something similar for the logs on the SCCM server itself?



Viewing all articles
Browse latest Browse all 629

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>