2 PowerShell Software Installation Examples
Hello to all SysAdmins, PowerShell users, and anyone who simply wishes to create simple, but useful code that will serve you, your systems, and your team well. Now, and in the future.
Below are some real-life examples of PowerShell scripts that I like to use for installing software (in this case, some prerequisites) on servers. Let's first break down the contents.
Recommended by LinkedIn
Write-Host "Installing URL ReWrite Module v2.1" -ForegroundColor blue -BackgroundColor white
# URL ReWrite Module v2.1 - requires IIS
# Useful command to see if the service is running: Get-Service W3SVC
# Download Source: https://www.iis.net/downloads/microsoft/url-rewrite
# Command Source: msiexec.exe /i rewrite_amd64_en-US.msi /?
cd ..\URL_ReWrite_Module_v2.1
msiexec.exe /i rewrite_amd64_en-US.msi /quiet /norestart /l* installLog.log
Start-Sleep -s 30
Write-Host "Installing PostgreSQL Admin v6.5x64" -ForegroundColor blue -BackgroundColor white
# PostgreSQL Admin
# Download Source: https://www.postgresql.org/ftp/pgadmin/pgadmin4/v6.5/windows/
# Command Source: https://silentinstallhq.com/pgadmin-silent-install-how-to-guide/
# Command Source: /ALLUSERS switch not documented on any website, but it works!
cd ..\PGAdmin_v6.5_X64
.\pgadmin4-6.5-x64.exe /VERYSILENT /NORESTART /ALLUSERS
Start-Sleep -s 30
Write-Host "REBOOT your server to complete installations before proceeding." -ForegroundColor red -BackgroundColor white
Enjoy and feel free to comment or share. Also, be sure to use the scrollbar at the bottom of the code example. ; )
Great Article Ryan! Love it!