Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Remoting issues

$
0
0

Very new to powershell here........I've got a script that I've pieced together to remove and reinstall java.  The script runs fine locally, runs fine when I enter-pssession on a remote workstation and kick it off......however, running with invoke-command -computername PC1 -filepath c:\scriptname.ps1 the re-install portion of the script doesn't work.  All workstations are Win7 64-bit and on the same domain.  Users of the remote machines don't have administrative rights (not sure if that's relevant here).  Remoting has been enabled via GPO.

# Script to update Java
# If there is a previous version installed we need to stop the process
if (Get-Process -Name Java -ea SilentlyContinue) {Stop-Process -Name Java -Force}

if (Get-Process -Name jucheck -ea SilentlyContinue) {Stop-Process -Name jucheck -Force}
 
if (Get-Process -Name JP2Launcher -ea SilentlyContinue) {Stop-Process -Name JP2Launcher -Force}
 
if (Get-Process -Name javaw -ea SilentlyContinue) {Stop-Process -Name javaw -Force}
 
# Now we need to uninstall the old version!
 
$app = Get-WmiObject -Class Win32_Product | Where-Object { 
    $_.Name -like "*Java 7*"
}
foreach ($a in $app) {$a.Uninstall()}

# Now we need to install the updated version!

$CMD = 'c:\windows\deploy\java.exe'
$arg1 = '/s'
 
& $CMD $arg1


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>