Jump to content


bigbirddk

Java Update - Only install if Iexplore.exe is not running or something else ?

Recommended Posts

Hey guys

 

I have a problem deploying my Java update.

i had previously just extracted the MSI file, and then set the software to install on the test computer, and it worked perfectly.

But if internet explore is open, and Java might be in use, and installing the update at this point, will corrupt the java installation, causing java to stop working.

 

I have changed the deployment to "only when no user is logged on", but that will require the computers to be at the login screen for a very long time, or have the users logoff during the day, and wait 5 minuttes, and then log back into Windows. This is NOT a solution we can use.

 

Is there a script i can run as a "requirement" for the Java update, that detects if iexplore.exe is in use, and if it is in use, it will check again later, or can I somehow set SCCM to download the package, and set it to install at either the next shutdown or login ? It appears not to be installed at the moment when it is set for "only when no user is logged on", because the SCCM client is longer to start, than our users is to do their login in the moring.

Share this post


Link to post
Share on other sites

Here is a little powershell script which will do what you want. It returns the error code 110 if a blocking process is in use and skip the installation.

 

run the script with the command line: powershell -executionpolicy bypass -file install.ps1

 

 

$Path = Split-Path $script:MyInvocation.MyCommand.Path
$ExitCode = 0
$Process = (Get-Process 'java','javaws','iexplore' -ErrorAction SilentlyContinue -FileVersionInfo)
if ($Process){
$ExitCode = 110
}
Else {
$ExitCode = (Start-Process -FilePath "$Path\jre-6u39-windows-i586.exe" -ArgumentList "/s /v""/norestart AUTOUPDATECHECK=0 JAVAUPDATE=0 JU=0""" -Wait -Passthru -NoNewWindow -ErrorAction SilentlyContinue).ExitCode
}
[Environment]::Exit($ExitCode)

Share this post


Link to post
Share on other sites

Thanks Peter.

 

Im not that good with PS yet, but I will try to make it work.

so I basically just create a file "install.ps1" with the exact coding, add the jre-7u13-windows-i586.exe, create a package with the 2 files, and add it to the deployment ?

 

Will "$Path = Split-Path $script:MyInvocation.MyCommand.Path" use the file from the DP or how will that work ?

 

And how would you deploy it ? If i deploy it as a default package, it will try to install, but if java is in use it will skip. When will it try again ? Do I need Windows Installer ID for detect that ?

 

And how can I make sure that I will not run on a system that already have java 7 u13 install ? Windows Installer ID that I grab from the MSI file ?

Share this post


Link to post
Share on other sites

You're welcome

 

1) Yes, you need only these 2 files in your source directory.

 

2) The split-path command extracts the path of the script location. So if you are using an application this will be the local cache directory. It's like a %~dp0 in batch files. So to speak a dynamic absolute path.

 

3) Create a new app and chose to specify the information manually. As deployment type chose Script installer Native.

 

4) To retrieve the product code just install the prgramm manually on one machine and either get it through wmi (wmiexplorer is great tool for this), or from the registry (hklm\software\microsoft\windows\currentversion\uninstall).

 

5) That's the benefit of the application model. As detection rule specify the product code and you will be fine.

Share this post


Link to post
Share on other sites

I run a vbscript in my environment to close IE before installing java

Dim oShell
Set oShell = WScript.CreateObject("WScript.Shell")
Set colProcessList = GetObject("Winmgmts:").ExecQuery ("Select * from Win32_Process")

For Each objProcess in colProcessList ' Loop checks all running processes and sets vFound to True if it finds iexplore.EXE running.
If objProcess.name = "iexplore.exe" then
vFound = True
End if
Next
If vFound = True then
oShell.Popup "Closing IE" & vbCrLf & vbCrLf & "Click OK if you are ready to continue now.",30,"Software Update"
oShell.Run "taskkill /F /IM iexplore.exe", 1, True
End If

 

And you can just change the '30' in the oshell.Popup line to however many seconds you want to give users before force-ably closing IE.

 

To make it run before the Java update, I created a task sequence with the vbscript first then the java update second.... Works pretty good.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.