Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 8583

installing msi on remote machines with parameters

$
0
0

Hi, Below is the script i am using for installing the msi on remote computers, the msi is already on those computers, the script does not work when i substitute the values with variables  but when i pass directly the values to the msi exec command the script works

$name=buildname

$num=buildnumber

$installdir="C:\data"

$msiname=$name-$num.msi
$srcpath ="C:\temp\$msiname"

$script={
                                                        #NOT WORKING#

##Invoke-Expression "msiexec /i $srcPath /qn ALLUSERS=1 REBOOT=ReallySuppress INSTALLDIR=$installDir SERVICEACCOUNT=$env:userdomain\$svcAcctName SERVICEPASSWORD=$svcAcctPwd /L* $installDir\$buildNum\$buildNum.log"

                                     #WORKING#

Invoke-Expression "msiexec.exe /i e:\temp\stage\NSA-Encryption-20101124.004.msi /qn ALLUSERS=1 REBOOT=ReallySuppress INSTALLDIR=e:\temp\data\AAA\website1 SERVICEACCOUNT=ABCD SERVICEPASSWORD=efgh"


}
$serverEnvList= "C27"
 $allsession=""
foreach ($server in $serverEnvList)
{
Write-Output($server)
 
}
$allsession = New-PSSession -Name $server -ComputerName $serverEnvList
Write-Host($script)
Invoke-Command -ScriptBlock $script -Session $allsession

 

Please help me in this regard

 


Viewing all articles
Browse latest Browse all 8583

Trending Articles