Could somebody assist me with the below scirpt. When I run it against the machine. It doesn’t install whatsoever. Also, I get this error below
Cannot find a process with the name “jre-7u45-windows-x64”. Verify the process name and call the cmdlet again. If Java is already installed would I have to uninstall it first before pushing the update?
Thanks for the help…
+ CategoryInfo : ObjectNotFound: (jre-7u45-windows-x64:String) [Get-Process], ProcessCommandException
+ FullyQualifiedErrorId : NoProcessFoundForGivenName,Microsoft.PowerShell.Commands.GetProcessCommand
function InstallJava {
param([String]$strComputer, $objFile, $sysArch, $antiarch)
write-host ""
write-host "Security Installer"
write-host ""
$JavaName = [string]$objFile.name
$JavaExt = $objFile.extension
$JavaFullName = $objFile.FullName
$JavaProc = ($JavaName.trimend(".exe"))
write-host $JavaProc
$JavaProc = [string]$JavaProc
if (($JavaName -Notmatch $sysArch) -and ($JavaName -match $antiarch))
{
return
}
if ($JavaName -match "ia64")
{
return
}
copy-item $JavaFullName \\$strComputer\c$\$JavaName -force
$install = (([WMICLASS]"\\$strComputer\ROOT\CIMV2:win32_process").Create("cmd /c c:\$JavaName /s"))
start-sleep -Seconds 5
$javatest = get-process -cn $strComputer -name "$JavaProc"
while ($javatest -ne $null)
{
start-sleep -seconds 1
write-host "waiting for java install to complete"
$javatest = get-process -cn $strComputer -name "$JavaProc"
}
<#
$javatest = get-process -cn target1 -name “trustedinstaller.exe” -ea silentlycontinue
while ($javatest -ne $null)
{
start-sleep -seconds 1
#write-host "waiting for install to complete"
$javatest = get-process -cn target1 -name "trustedinstaller.exe" -ea silentlycontinue
}
#>
}