New to Powershell

This topic contains 4 replies, has 3 voices, and was last updated by Profile photo of Yuan Li Yuan Li 7 months, 3 weeks ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #34875
    Profile photo of Stephen Jones
    Stephen Jones
    Participant

    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
    Profile photo of Matt Bloomfield
    Matt Bloomfield
    Participant

    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
    Profile photo of Yuan Li
    Yuan Li
    Participant

    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
    Profile photo of Stephen Jones
    Stephen Jones
    Participant

    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
    Profile photo of Yuan Li
    Yuan Li
    Participant

    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?

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.