By Howard Magill, CEO at Road Map Technologies
I’m bringing this up now because, there are a lot of engineers out there that still don’t do it right. Yes, I know, there are some good BAT files out there for SCCM. However, most deployment engineers I have seen are not writing them properly. Over the years, I have consulted with many companies, and the companies using BAT files all had logic issues that were not considered best practice. It has been my experience, most of the bat files created all had similar issues.
Example:
- The BAT files didn’t capture exit codes this causes all deployments to be successful. It also generates a lot of help desk tickets because the end user does not receive the application.
- I have rarely seen any type of logging for the bat file. This makes troubleshooting an issue. If it is a complex batch file, it should be logged to easily identify where the failure occurred.
- Many times, the installs are launching from network shares and not leveraging the DP’s for SCCM. Source is cached to system, but the bat file has UNC paths in it to launch from, bypassing the SCCM cache.
- The use of a batch file may not be needed. Meaning, if it is a simple install, just run the command line and make sure you add the logging.
I prefer using straight command lines these days for silent installs, and \ or leveraging PSAppDeployToolkit to do the automation. It is a sweet tool, and its priced right. It is a free download. Also there are a lot of “How To’s” out there and I have provided a few links at the bottom of this article.
What is PSAppDeployToolkit?
“The PowerShell App Deployment Toolkit provides a set of functions to perform common application deployment tasks and to interact with the user during a deployment. It simplifies the complex scripting challenges of deploying applications in the enterprise, provides a consistent deployment experience and improves installation success rates.”
“The PowerShell App Deployment Toolkit can be used to replace your WiseScript, VBScript and Batch wrapper scripts with one versatile, re-usable and extensible tool.”
PSAppDeployToolkit is a great option for automation if you don’t have a repackaging tool set like RayPack, AdminStudio or Pace Suite. A lot of functionality is already in the PSADT template. The built-in functions of PSAppDeployToolkit can accomplish probably 90%, if not higher, of automation to install, update, or uninstall an application or a quick fix.
I believe it is important to note that some repackaging tools have incorporated PSADT support into their toolsets for ease of automation. If you don’t currently have the capability with your toolsets, verify your maintenance is current and reach out to the vendor to see what version has it included.
Below is a short list of built in functions.
- Logs for the script
- Pass cmd lines to installs to log
- Read \ Modify Registry
- Predefined commands for:
- Start\stopping process
- Defers to allow users to wait to install
- Messages
- Execute – Process
- Active Setup
- And much, much more.
- Log, log, log
- Identify a folder to log all installs to.
- When running into issues with application deployments, the first place I go is to the install logs, then to SCCM logs for the most part.
Remember, always log your scripts and installs. Be sure to always capture the exit codes to pass to your deployment tools, and be sure not to hardcode paths in your scripts. As not to be redundant, I have provided some “How To” links from other bloggers that have done a good job of covering psappdeploytoolkit.
- Related Articles
Feel free to contact us here.