-1

Can someone explain why this works:

$cred = Get-Credential
Start-Process -FilePath "msiexec.exe" -ArgumentList "/i `"C:\temp\jre1.7.0_17.msi`"" -Credential $cred -wait

but this doesn't:

$cred = Get-Credential
Start-Process -FilePath "msiexec.exe" -ArgumentList "/i `"C:\temp\jre1.7.0_17.msi`" ""`/qn REBOOT=ReallySuppress JAVAUPDATE=0 WEBSTARTICON=0 SYSTRAY=0`" ""/log c:\temp\javainst.log" -Credential $cred -wait
Chris Laplante
  • 29,338
  • 17
  • 103
  • 134
user2162722
  • 11
  • 2
  • 2

1 Answers1

0

The first thing I'd worry about is the way you escape every special character. When done right, it will work fine, but it seems unnecessary here. If you need to include double quotes in your string, then pack your argument inside single quotes.

Can you try the following and see if it helps?

$cred = Get-Credential
Start-Process -FilePath "msiexec.exe" -ArgumentList '/i "C:\temp\jre1.7.0_17.msi" /qn REBOOT=ReallySuppress JAVAUPDATE=0 WEBSTARTICON=0 SYSTRAY=0 /log c:\temp\javainst.log' -Credential $cred -wait

Also, as I commented in your previous very similar post, can you explain why you need to use msiexec instead of java's own exe setup?

EDIT Try this:

$cred = Get-Credential
Start-Process -FilePath "c:\temp\jre-7u17-windows-i586.exe" -ArgumentList '/S /L c:\temp\javainst.log REBOOT=ReallySuppress JAVAUPDATE=0 WEBSTARTICON=0 SYSTRAY=0' -Credential $cred -wait
Frode F.
  • 52,376
  • 9
  • 98
  • 114
  • I inserted your replacement, but no luck with the installation. How would you run the install line if you were working with an .exe? I can't get that to work either, but it would be easier to use in a batch file. – user2162722 Mar 13 '13 at 19:18
  • try the updated answer. Be aware that I haven't tested it. Read more at: http://www.java.com/en/download/help/silent_install.xml and download the exe setup from http://www.java.com/en/download/manual.jsp – Frode F. Mar 13 '13 at 19:52