Skip to content

Application removes whilst in use

Featured Replies

Hi all, First post so here goes.

 

Running SCCM 2007 and trying to deploy a newer revision of our SAP gui to about 200 users.

The problems arise when I deploy to a machine where the application is installed and in use, the batch removes the currently installed version in the background and throws the user out of the Gui. The application then send SCCM a notification to say successful.

 

Is there any way to make the package wait till the files are not in use before removing?

 

Here is the command line I have used to remove and install the new revision of the gui.

 

REM ***Removal***

"C:\Program Files\SAP\SAPsetup\setup\NwSapSetup.exe" /uninstall /product="ECL710+BW350+KW710+GUI710ISHMED+GUI710TWEAK+JNet+SAPGUI710+SAPBI" /TitleComponent:"SAPGUI710" /IgnoreMissingProducts /silent

 

REM ***Installation***

"%~dp0RSL_SAP_GUI_72_7_20110809_1041.exe" /silent

msiexec.exe /i "%~dp0SapGuiAdditionalFiles.msi" RebootYesNo="No" Reboot="ReallySuppress" /qn

 

Thanks for any help on the matter.

S

depending on how friendly you want to be, you could check for the GUI process running before running the removal. If it is, either fail the upgrade or kill the process depending on how you want to approach it.

  • Author

Thanks for the response.

 

What command line would you use to query that the process is running? I dont want to kill the process as this would also throw the user from there session.

Just a query to result whether to proceed with the install or pause until files are not in use would be helpful.

 

Thanks

S

Hello,

 

You'd probably want to have a wrapper script that waits (up to a limited period of time, not perpetually) for the GUI process to exit, and then proceed with the installation.

 

Although that is the traditional method, you can also register for WMI events using Windows PowerShell, and immediately begin the installation after the process has exited. The WMI query you would use to subscribe for such events would look like this (against the root\cimv2 WMI namespace):

 

select * from __InstanceDeletionEvent within 10 where TargetInstance ISA 'Win32_Process' and TargetInstance.Name = 'sapgui.exe'

 

Of course, you'll need to replace 'sapgui.exe' with whatever the actual process name is, but you get the idea.

 

To use this practically in PowerShell, you would use the Register-WmiEvent cmdlet, along with the -Query, -Namespace, and -Action parameters. The value passed to the -Action parameter would be a PowerShell ScriptBlock that could fire off your setup program, along with any other tasks. You may want to insert a final check for any remaining instances of 'sapgui.exe' in the event that there were multiple processes with the same name (though I've left this out of the example below).

 

$ActionBlock = { setup.exe /s; }

Register-WmiEvent -Namespace root\cimv2 -Query "select * from __InstanceDeletionEvent within 10 where TargetInstance ISA 'Win32_Process' and TargetInstance.Name = 'sapgui.exe'" -Action $ActionBlock

 

Hope this helps.

 

 

Cheers,

Trevor Sullivan

http://trevorsullivan.net

http://twitter.com/pcgeek86

related to Lucids remark, the general best practise is to mail an IT Upgrade annoucement to the group of users affected, and/or post it on your Annoucements section of your company intranet etc..

 

Then schedule the update with interaction from the user to confirm run and have a mandatory end date, to run out of hours if needed also.

much much simpler, no need to over complicate it.

 

**step back out of the box, POV*

  • 3 weeks later...
  • Author

Thanks for all your suggestions!

 

I have set a 90 minute timer on the application to install with SCCM and given the users the ability to run independently. I have also sent out comm's to let the user base know what to expect as part of the roll out.

 

Using this route on another package I have included a VB front end to inform the user an application will install over the next hour etc etc and what to expect. This helped pause the job until the user accepts the splash screen (all close function have been hidden) I will probably use this going forward for most big applications.

 

User communication is always the best route forward :) Thanks.

  • 2 weeks later...

Just by the way. There is no need to uninstall SAPGui 7.10 before installing 7.20. The Setup Routine is doing that by itself, if it is configured right. I have just updated 4200 clients to 7.20.

Simply put the installation in a task sequence and put 2 wmi queries as condition on the installation step. First one checking the installed version and the second any running SAP process.

Set the advertisement on rerun and put a schedule on it. Link it to a collection which checks the installed version of SAP.

Hi,

 

You can send us the 2 WMI queries used as condition on the installation step ?

 

Thks

Hi Kimounje,

 

here you go. Both need an if statement with the option "none".

 

Select * FromM Win32Reg_AddRemovePrograms Where DisplayName = "SAP GUI for Windows 7.20"

 

Select Caption from Win32_Process Where Caption Like "SAP%"

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...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.