New to Powershell

Welcome Forums General PowerShell Q&A New to Powershell

This topic contains 4 replies, has 3 voices, and was last updated by

 
Participant
2 years, 10 months ago.

  • Author
    Posts
  • #34875

    Participant
    Points: 0
    Rank: Member

    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

  • #34880

    Participant
    Points: 25
    Rank: Member

    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.

  • #34882

    Participant
    Points: 0
    Rank: Member

    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 }

  • #34908

    Participant
    Points: 0
    Rank: Member

    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.

  • #35009

    Participant
    Points: 0
    Rank: Member

    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?

The topic ‘New to Powershell’ is closed to new replies.