How to use “On startup scripts” in your APP-V package, showed by using our “Phillips IntelliSpace” package

There's so many creative ways to make sure your Sequenced App-V applications always have a perfect launch when it starts up. This can often be done by loading the correct config data, and without having to do manual configurations and so avoiding error messages.


Most of the time this can be put in the registry or a config file for the package, or scripted into the machine during the add or publishing phase with a run once event script.

But sometimes this will not work, maybe because another process has to be started first, maybe because the application have a poorly designed license registration. We may first need to check if other processes are stopped or running fine before the virtual application starts up and can be licensed.

One way is to create an “On process start” script for your applications .EXE file(s), this will be started before your main executable file is started.

First thing you do in the Sequencer, check your “Shortcuts and FTAs” tab.

If you don’t see the correct .EXE file there I don’t know if you can do this any other way in the Sequencer then editing your manifest.xml files with an external editor like ACE and then importing it again. Or maybe create the shortcuts while still in the monitoring phase.

 

Normally you just choose the correct ApplicationID from the list in the Manifest file when you open it from ACE editor.

 

If you don’t see the correct .EXE file there you have to do some additional steps to add them.

First of all, in this example I will now use the NOT free editor AVE because it’s way faster and safer then editing the manifest.xml files. If you don’t want to pay for this, you could try adding shortcuts to your programs during seq. mode or just editing manifest files with ACE.

 

First go to “Virtual applications” in AVE.

 

Then press the “Publish new application” button, and choose browse package for the correct .EXE file.



Choose the correct .EXE file and push SELECT.

Now it will be available to use for “Start Process” scripts.

Next in this example we have been sequencing “Phillips Intellispace”.

This application was pretty straight forward to Sequence, but you need to be aware that the software will always check for content verification from the IntelliSpace server. This will cause an error as it can't write some files to the VFS. We did a quick procomon trace, and also tried a quick shimming fix, and a junction point fix without any luck.

 

If you press the ok button it will work as it should, or wait for about 60sec before it would auto close.

So the application works as it should, but this error will be confusing for any enduser and that is why the user start script has been created so it can supress this error.

Using Tim’s excellent AppV_Manage debugger we could see the problem process showing the error message was called AppletHost.exe

 

So, we needed to make sure Applethost.exe process was intercepted and killed on every first launch of the main program, so the error message would not be seen by the end user.
But it was important it was only on the first launch of the AppletHost.exe, so to make this happen we ended up making a small but effective powershell script that put a registry “detection rule” in HKCU on the process after the first “kill”. We hooked it up on to the process logviewer.exe.

We wrap all our scripts into a cmd script, only running the powershellscript it would then look something like this:
powershell.exe -windowstyle hidden -File "RegCheckandKill.ps1"

 

Script is running inside the virtual Env.



Wrapped inside “userstartprocess.cmd”

 

This is our small startup ps script, running it once and creating the registrykey makes sure it will not be killed again since Applethost.exe could still be used for other things in the program.

 

 

We then hooked another small PowerShell script to the exit Process script “WorkflowHost.exe” we would then delete this registry setting so it will be found again on next launch.

 

 

 

 

The “DeleteRegKeyonProcessExit” powershell script.

 

 

And as always, hope this will be of help to someone.

 

 

No comments:

Post a Comment