Author Posts

February 4, 2016 at 1:51 pm

Hello all,

I'm working on installing Java on remote hosts and have the basis for a script. However, I'm having problems with installing java remotely either by invoke-command or enter-possession. I use the following line to install Java successfully locally but so far the command will complete remotely with no errors but does not install java. Any ideas on how to troubleshoot this?

Start-Process -FilePath c:\temp\java.exe -ArgumentList "/s" -PassThru -Wait

February 4, 2016 at 2:59 pm

Does the process start?

If it starts, enable logging with the arguments /L

FWIW, in the enterprise, you're probably better off deploying the MSI.

February 4, 2016 at 3:56 pm

Hi Stephen

Try this and it should work

Invoke-Command -ComputerName $computerName -ScriptBlock { Start-Process -filepath "c:\temp\jre8.exe" -argumentlist "/s /L c:\temp\install.txt" -Verb runas -PassThru -Wait }

February 5, 2016 at 6:14 am

Thanks for the responses Matt & Yuan!! I ran the following command:
Invoke-Command -ComputerName cpu -Credential dom\acc -ScriptBlock { Start-Process -filepath "c:\temp\java.exe" -argumentlist "/s /L c:\temp\install.txt" -Verb runas -PassThru -Wait }

The command executes and responds :
Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName PSComputerName
——- —— —– —– —– —— — ———– ————–
0 2 50864 152 54 0.05 1164 java cpu

However, there is no log file and java does not install.

February 8, 2016 at 1:51 pm

Hi Stephen,

I tried it on my windows 2012 R2 server remotely and it was working. The java is installed and log was created.

Do you use an admin account ? Does this account have write permission on your c:\temp folder?