windows server 2008 r2 - Install .msi remotely using Powershell -


i have made following code using code present on forum.

cls $computername = get-content 'c:\users\c201578-db\documents\server.txt' $sourcefile = "\\iceopsnas\lnt_softwarerep.grp\core\cots\emc\avamar\avamar_7.0\cr06794393\avamarclient-windows-x86_64-7.0.102-47.msi" #this section install software  foreach ($computer in $computername)  {     $destinationfolder = "\\$computer\c$\avamar"     #this section copy $sourcefile $destinationfolder. if folder not exist create it.     if (!(test-path -path $destinationfolder))     {         new-item $destinationfolder -type directory     }     copy-item -path $sourcefile -destination $destinationfolder     write-host "copied successfully"     invoke-command -computername $computer -scriptblock { & cmd /c "msiexec.exe /i c:\avamar\avamarclient-windows-x86_64-7.0.102-47.msi" /qb advanced_options=1 channel=100}     write-host "installed successfully" } 

i tried permutations , combinations no luck. tried suggestions got while posting question nothing. copy procedure successful .msi file not getting installed. maybe question gets marked duplicate still suggest edits before doing that.

thanks again.

as workaround (the lack of details doesnt daignose problem), use third party tool psexec.exe run installer on remote host.

try replace invoke-command

psexec.exe \\$computer -s -u adminuser -p adminpassword msiexec /i c:\avamar\avamarclient-windows-x86_64-7.0.102-47.msi /qb advanced_options=1 channel=100