Product and service reviews are conducted independently by our editorial team, but we sometimes make money when you click on links. Learn more.

Automating Software Installs with PowerShell

By - Source: Toms IT Pro

PowerShell scripts can help you supplement or replace the more expensive options.

Deploying software to endpoints is a like that whack-a-mole game. The moment an IT administrator does the research, creates the package, distributes the software to machines and gets it installed is the time to do it all over again. The software is continually being updated especially for software vendors that practice Agile development practices. It's impossible for administrators to keep up even in an SMB with only a few hundred machines.

Luckily, deploying software to endpoints consists of a standard process.

  • Figure out how to install the software silently
  • Package up the software
  • Define the target group of machines to push the software to
  • Distribute the software to the machines
  • Silently install the software

Because of this standardized process, this task is ripe for automating. There are a few tools on the market today that assist the administrator in this process like Microsoft's System Center Configuration Manager (SCCM), Symantec's Endpoint Management, Dell KACE and so on. These tools expedite the process but still leave gaps and require to be customized to each environment.

One way to complement these tools to fill in the gaps (or even act as a simple replacement) is PowerShell. Writing PowerShell scripts to perform various software deployments steps allows complete flexibility in what, how and when software deployed.

MORE: Best Windows 10 Apps for IT Pros

Let's check out a few ways that by utilizing various free, community tools and a little ingenuity an administrator can automate software deployments.

Because PowerShell can perform just about any task that it's asked of, let's go over and end-to-end solution using only PowerShell. Granted, this approach might not apply to larger organizations, but nevertheless, large organizations can gain some knowledge in their automation gaps while SMBs might be able to exclusively use PowerShell to deploy software to their clients.

To get started, we need first to figure out the software to deploy. In this example, I'll be using the Malwarebytes software package.

To get started, I'll first build a small script where we can define each machine to distribute this software to which will provide a launching pad for everything else. To save some time, I've already built an example script that is available for download. I'd like to deploy this MalwareBytes software to a couple of my clients named MEMBERSRV1 and LABSQL. I will rename the script I downloaded to Deploy-Software.ps1 and run the script like this:

& .Deploy-Software.ps1 -Client 'MEMBERSRV1','LABSQL' -InstallerFilePath C:Softwarembam-setup- -Verbose

Now if you would check each of the clients, you will now see that MalwareBytes has been installed.

Better yet, verify the software was installed by using PowerShell as well.

Notice that by using PowerShell; an administrator can do just about anything that's necessary to deploy software. However, this approach is a simple one. Deploying software to thousands of machines opens up a whole new suite of problems. But this PowerShell-only approach should have provided some good examples of just what's possible to automate using PowerShell.

The next time you need to get a piece of software deployed, think about your options. If already using an expensive tool, by all means, continue to use that. However, always know that PowerShell can fill in any of those holes the tool may have or if it's necessary just to do some ad-hoc deployments to a few machines here and there, that expensive tool may even be overkill.