← script library

Automating Software Deployment with PowerShell

Software DeploymentJanuary 4, 2025

In this post, we will focus on automating software deployment using PowerShell. This script is designed to help system administrators streamline the process of installing applications on multiple machines within their network. By automating software deployment, you can save time, reduce errors, and ensure consistency across all installations.

powershell
# Define software parameters
$softwareName = "YourSoftware"  # Replace with your software name
$installerPath = "\\NetworkShare\Path\To\Installer.exe"  # Network path to the installer
$installArgs = "/silent"  # Command-line arguments for silent installation

# Specify target machines
$targetMachines = @("Machine1", "Machine2", "Machine3")  # Replace with actual machine names

# Deploy software using PsExec
foreach ($machine in $targetMachines) {
    $psexecCommand = "psexec \\\\$machine -u Domain\Admin -p YourPassword $installerPath $installArgs"
    Invoke-Expression $psexecCommand
    Write-Host "Deployment initiated for $softwareName on $machine."
}

# Check installation status
foreach ($machine in $targetMachines) {
    $installedSoftware = Get-WmiObject -Class Win32_Product -ComputerName $machine | Where-Object { $_.Name -eq $softwareName }
    if ($installedSoftware) {
        Write-Host "$softwareName is installed on $machine."
    } else {
        Write-Host "ERROR: $softwareName is not installed on $machine."
    }
}

# Summary of actions
Write-Host "Software deployment script completed."
Write-Host "Please check the installation status on the specified machines for any issues."

Run it across your fleet

This script runs as-is on a single host. Paste it into ServerEngine to schedule it, run it on a whole server group in parallel, and keep the credentials out of the file — see the scripts documentation and the credential store.

Ready when you are.

Try ServerEngine free for 7 days.