To install any software silently
Researching silent options is just a onetime effort for you and saves you lot of time. This script is useful for sys admins who prepare desktops, laptops or deploy servers.
.csv file contains data in comma separated values format and looks like this…
Installer,Switch
Firefox Setup 72.0.2.msi,/qn
AnyDesk.exe,–install “C:\Anydesk” –start-with-win –silent –create-shortcuts –create-desktop-icon
7z1900-x64.msi,/qn
Chef-client-15.7.32-1×64.msi,/qn
Npp.7.8.3.Installer.exe,/S
ChromeSetup.exe,/silent /Install
I have attached sample .csv and script file for your reference.
If you see above list of software, they all have different silent options, but even the script works like a charm.
#################################################################################### # Author: Charan Baisetty # # Purpose : To silently install any software on windows # # Description: Place csv and software files in a share, do research for your apps # # silent options and add them to csv file. # # Video for this script : www.youtube.com/c/netxopsvideos # #################################################################################### $path = "\\server\softwares\" $softwares = import-csv "\\server\softwares\pkgs.csv" -Delimiter "," -Header 'Installer','Switch' | Select-Object Installer,Switch foreach($software in $softwares){ $softexec = $software.Installer $softexec = $softexec.ToString() $pkgs = Get-ChildItem $path$softexec | Where-Object {$_.Name -eq $softexec} foreach($pkg in $pkgs){ $ext = [System.IO.Path]::GetExtension($pkg) $ext = $ext.ToLower() $switch = $software.Switch $switch = $switch.Tostring() if($ext -eq ".msi"){ mkdir c:\Temp\Softwares -Force Copy-Item "$path$softexec" -Recurse c:\Temp\Softwares -Force Write-host "Installing $softexec silently, please wait...." -foregroundColor Yellow Start-Process "c:\Temp\Softwares\$softexec" -ArgumentList "$switch" -wait Remove-item "c:\temp\softwares\$softexec" -Recurse -Force Write-host "Installation of $softexec completed" -foregroundColor Green } else{ mkdir c:\Temp\Softwares -Force Copy-Item "$path$softexec" -Recurse c:\Temp\Softwares -Force Write-host "Installing $softexec silently, please wait...." -foregroundColor Yellow Start-Process "c:\Temp\Softwares\$softexec" -ArgumentList "$switch" -wait -NoNewWindow Remove-item "c:\temp\softwares\$softexec" -Recurse -Force Write-host "Installation of $softexec completed" -foregroundColor Green } } }