Jump to content
LabTechRob

How to: Install Applications

Recommended Posts

This script will perform a silent, unattended install or upgrade of the ConnectWise Client (version 12.2). This is a good script to reference no matter what you are installing as will either install the application on the target computer or notify you that installation could not take place via a LabTech ticket. This script is blueprinted below:

 

Lines 1 & 2: Make sure we aren’t running this on anything other than a Windows Desktop

Lines 3 & 4: Determine existing installation (or lack thereof) version number. Do an if\then against desired version number & exit if detected. I usually prefer to do this through the registry but not all software vendors use the registry for version stamping. When that’s not available, use LabTech to determine the executable file’s version in ‘Properties’.

Line 5: In testing I found that older version of ConnectWise may be in a different file path. This line says, if I didn’t find anything at the specified location then check the alternate location and perform the same operation

Line 9: The ConnectWise client requires .NET 3.5 as a prerequisite. See how this script ensures the target computer has the prerequisite? Simple use a script line to call the installer. ALL of your installers should first start with a version check so you may run them as often as you want on a computer and it will only have impact if not running the right version.

Line 10: We shouldn’t assume our .NET installer installed properly. Because LabTech remembers our variables, even across different scripts, we look here for the flag that shows .NET didn’t install properly. If that’s the case, no point in continuing with our ConnectWise install (time to call a Human!)

Lines 11 & 12: Two different installers call for two different script lines. Note, regardless of the file that’s downloaded, it’s saved as ‘CWInstall.msi’. This is so we only need one line to run our installer…

Line 13: Trust me – msiexec.exe is your friend. Use on all installs, whenever possible and learn your command line settings! Note this command will execute a silent install and write a local log file.

Line 14: Upload that log file. You’ll almost never need it but if a computer is acting strangely, it might be a good time to review. Open the computer in LabTech, hit the ‘Tools, Tasks & Group’ tab. Look in ‘Uploaded files’ Do you see ‘cwinstall.log’? That’s the install log, double click to open. LabTech will honor your local desktop’s MIME types here.

Line 15: This is to enable a unattended uninstall of the application. This page http://labtechrob.blogspot.com/2013/04/solved-how-to-enable-labtech-remote.html explains in more detail

Line 16: Re-inventory the software list so our software tab shows the brand new title.

Line 17: No need to keep our build file on the target so deleting it.

Lines 18 & 19: Run the exact same check on the local computer to determine we have, in fact, installed the proper version. If so, nothing left to do but exit.

Line 20: The only reason we’d get to this script line is after calling the installer we check and still don’t have the right version installed. Again, time to call a human!

 

 

The reason I’m writing a blow-by-blow here is so you can include all the elements necessary for a high-percentage deployment script for all your applications. To nutshell:

 

Check version. If correct, exit out

Download the installer

Run the installer silently and with log file output

Check version, if incorrect create ticket.

 

I know this seems like a lot of effort for a simple install script but if you create all of your installer scripts like this, I’m sure you’ll find you saved yourself a ton of work in the long run.

 

Happy LabTeching Everybody!

Install Connectwise PSA.zip

Share this post


Link to post
Share on other sites

Finding the silent install parameters for your package can be quite hard. This site contains many silent install parameters for many packages. http://wpkg.org/Category:Silent_Installers

 

You will need to search for you application and find the XML file they are using. It looks like this

<?xml version="1.0" encoding="UTF-8"?>


        name='Adobe Acrobat 6.0 Professional'
        revision='1'
        priority='10'>











 

Look for the Install and Remove lines. See how they have the parameters and comandline. Sometimes the installer uses MSIexec.exe and other times its an installer file. You might need to make sure the installer file is the same version as the XML your using.

Share this post


Link to post
Share on other sites

A big part of being a good automator is predicting what the user will need and preemptively providing it. This script is a good example of missing a step. ConnectWise documentation highly recommends clearing the local Internet cache immediately after installing the client. So why not make our script do it for them?

 

I spoke with their helpdesk and found the essential elements to clear are Temporary Internet Files, Cookies and history. If you look at this page: http://www.techrepublic.com/blog/window-on-windows/how-to-clear-your-internet-explorer-version-7-cache-from-the-command-line/574, you can see there is a command line way to do it. That's all we need! Let's get scripting.

 

On the posted script, I just added line #16:

Shell: RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 11

 

(Note: If you're wondering where '11' came from, look at it this way. CW support said to clear Temporary Internet Files (#8), Cookies (#2) and History (#1). 8+2+1 = 11. Rather than run the command three times, just add the different element ID's together and it'll do more than one thing.)

 

Moral of the story: Predict your user's needs and automate delivery before they ask. Happy LabTeching!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×