bigbirddk Posted February 5, 2013 Report post Posted February 5, 2013 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. Quote Share this post Link to post Share on other sites More sharing options...
Peter33 Posted February 5, 2013 Report post Posted February 5, 2013 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) Quote Share this post Link to post Share on other sites More sharing options...
bigbirddk Posted February 6, 2013 Report post Posted February 6, 2013 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 ? Quote Share this post Link to post Share on other sites More sharing options...
Peter33 Posted February 6, 2013 Report post Posted February 6, 2013 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. Quote Share this post Link to post Share on other sites More sharing options...
lord_hydrax Posted February 7, 2013 Report post Posted February 7, 2013 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. Quote Share this post Link to post Share on other sites More sharing options...
bigbirddk Posted February 7, 2013 Report post Posted February 7, 2013 Thanks Peter33 for the clarification Thanks lord_hydrax for another and simple solution I dont know which I will choose yet, as I need to test it a little bit, but I will definatly be using both of those task later an for other tasks. But very simple and effective scripts Quote Share this post Link to post Share on other sites More sharing options...