This content is part of the Essential Guide: The go-to Windows PowerShell guide

How can you use PowerShell to enable automated software deployment?

The quest to keep up with constant changes to software is tough for IT admins, but they can make their lives easier by automating the deployment process using PowerShell.

Software vendors are constantly updating their products, making it nearly impossible to keep up without automated...

software deployment.

Deploying software to enterprise desktops without automation is like whack-a-mole. As soon as you do the research, create the package, distribute the software to desktops and get it installed, changes pop up and it's time to do it all again.

Luckily, deploying software to enterprise desktops is a standard process. You must package up the software, define the target group of machines to push the software to, distribute the software to the machines and install it without disrupting user workflows.

Tools such as Microsoft's System Center Configuration Manager, Symantec's Endpoint Management and Dell KACE can enable automated software deployments. These tools expedite the process but still leave gaps. Windows PowerShell, a command-line shell, can help fill in the gaps. In fact, small and medium-sized businesses might be able to exclusively use PowerShell to deploy software. PowerShell scripts for various deployment steps allow for complete flexibility in what, how and when you deploy software.

Larger organizations must keep in mind that deploying software with PowerShell is a very simple approach, however. Deploying software to thousands of enterprise desktops opens up a whole new suite of problems. Still, a PowerShell-only automated software deployment approach can provide some good examples of just what's possible to do with PowerShell.

Using PowerShell for automated software deployment

Deploying software to enterprise desktops is like whack-a-mole.

To get started you must figure out which software to deploy. Then build a small script to define each machine you want to distribute the software to. The script provides the launching pad for everything else. Here is an example script.

For example, if you want to deploy the Malwarebytes software package to a couple of desktops named MEMBERSRV1 and LABSQL, rename the script you downloaded to Deploy-Software.ps1 and run the script like this (Figure A):

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

PowerShell script
Figure A. The PowerShell script at work

Now if you check each of the desktops, Malwarebytes should be installed (Figure B).

The software is installed
Figure B. Installation success

Better yet, you can verify you successfully installed the software using PowerShell as well (Figure C).

Using PowerShell to check the installation
Figure C. Check the installation in PowerShell itself

The next time you deploy a piece of software, think about your options. If you already use an expensive tool, by all means, continue to use it. Always know that PowerShell can fill in any holes the tool may have. And if you just need to do some ad hoc deployments to a few machines, your expensive tool may be overkill.

Next Steps

Using WMI and the CIM standard with PowerShell

How PowerShell fights security threats

Working with PowerShell cmdlets

Dig Deeper on Windows 10