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:
- Build the batch file that calls the installer and does the post installation configuration:
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"
Performs a variety of operations: xcopy /r /y, md/mkdir, reg add/delete, regedit /s; Each operation is redirected to >>!logfile! 2>>&1
- Test each batch file the follow this process:
- confirm no errors on screen during install
- confirm no errors in logs after install
- confirm application successfully installed, which means:
- checking the location of where the app is expected to install to verify its there and it works
- checking that all applicable changes were made successfully
- so I'm looking for registry entries, configuration files, directory creation etc - everything in the batch
- checking Programs and Features to validate its presence
- 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
- I create new Application in SCCM
- Select Windows Installer (*.msi file)
- Choose msi file from \\unc\path\application\fullinstaller\file.msi
- Make any necessary adjustments to the General information screen
- Close Application Wizard
- Edit Properties of newly created Application
- Go to Deployment Types tab
- Select the MSI entry in there & click Edit
- Go to the Content tab & alter directory
- During creation its pointed to \\unc\path\application\fullinstaller\file.msi
- 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
- Go to Programs tab
- Change Installation program to the batch file: install_myapp.cmd
- Change Uninstall program to the batch file: uninstall_myapp.cmd
- Click Apply & click OK
Ok, now that all my changes are made, I need to get this into the DP:
- I Deploy Content (if I haven't already done so)
- Right click on Application > Distribute Content > Add DP > Continue through Wizard
- Redistribute Content (especially if edits were made to existing applications)
- Right click on Application > Properties > content Locations > Select location > Click Redistribute
- Verify deployment/redistribution via Content Status > View Status
- 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
- It successfully downloads but installation fails with a variety of errors (see below):
- 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).
- Unable to make changes to your software.
- I check "Program Files (x86)" and I see the program installation directory & its populated with files.
- I check "Programs and Features" and I see the application listed. I can uninstall, change & repair.
- I restart software center, refresh it a few times and the application is still listed under 'Available Software' and 'Installation Status'.
- If I click 'Retry' it immediately disappears from view
- 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'
- 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
- With application 'X' installed, from the 'Installed Software' tab I click 'Uninstall' and like before I get an error:
- 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).
- Unable to make changes to your software.
- I check "Program Files (x86)" and the other tasks - its still installed and everything is still in place.
- 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?
- Right click on Application > Deploy Content & complete wizard (if I haven't already done so)
- 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?