Avatar of Albert Widjaja
Albert WidjajaFlag for Australia

asked on 

Powershell script to Upgrade custom software MSI packaged (InstallShield) across multiple servers in the domain

Hi People,

Can anyone here please help me in upgrading a custom MSI software that is already installed in multiple Windows Server 2003 and 2008 in my domain using powershell script ?

The following is the script that I've used to restart the service if present but obviously I need to reinstall the application from shared folders named \\FileServer1\folder1\CustomApp1.msi

any kind of assistance and help in modifying this script would be greatly appreciated.

Thanks.
$path = "C:\path\"
$serverlist = get-content "$path\serverlist.txt"
$servicename = "CustomApp1"
foreach ($server in $serverlist) {
	 $result = Test-Connection $server -Count 1 -Quiet
	 if ($result -eq "True") {
		 $ServiceInstalled = Get-Service -name $servicename -ComputerName $server -ErrorAction SilentlyContinue
		 if ($ServiceInstalled.Name -ne $servicename) {
			Add-Content "$path\noservice.txt" -Value ("$server" + " " + "Service $servicename is not present")
		 }
		 else {
			 # Perform Install .MSI package
			 Start-Sleep -Seconds 60
			 sc.exe \\$server stop "$servicename"
			 Start-Sleep -Seconds 5
			 sc.exe \\$server start "$servicename"
			 Add-Content "$path\Installed.txt" -Value ("$server" + " " + "Service $servicename has been upgraded")
		 }
	 }
	 else {
		Add-Content "$path\noping.txt" -Value $server
	 }
 }

Open in new window

PowershellActive DirectoryWindows Server 2008

Avatar of undefined
Last Comment
Albert Widjaja
ASKER CERTIFIED SOLUTION
Avatar of MidnightOne
MidnightOne
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Albert Widjaja
Albert Widjaja
Flag of Australia image

ASKER

Yes that What I had in mind as well, but I need to know which servers failed to install ?
Windows Server 2008
Windows Server 2008

Windows Server 2008 and Windows Server 2008 R2, based on the Microsoft Vista codebase, is the last 32-bit server operating system released by Microsoft. It has a number of versions, including including Foundation, Standard, Enterprise, Datacenter, Web, HPC Server, Itanium and Storage; new features included server core installation and Hyper-V.

86K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo