Wednesday, February 24, 2016

How to run multiple scripts in App-V 5.1

Later today when I opened my blog to update a new post, I found that I already had quite some posts in drafts section. Few of them are outdated and few needed to be updated to the current date. I will be updating them and post them as soon as possible. The first post to clear from my draft bucket is how to add multiple scripts in App-V.


Earlier in App-V 5.0 it wasn't possible to run multiple scripts in deploymentconfig.xml or userconfig.xml file.

But in the latest App-V 5.1, it supports running multiple scripts both in deploymentconfig.xml or userconfig.xml file with the help of ScriptRunner.exe.


ScriptRunner.exe comes along with the App-V 5.1 client and gets installed in the client folder.






You can check how to use the ScriptRunner.exe and its parameters by opening up CMD and running ScriptRunner.exe /?






You can add multiple scripts by adding them as arguments to the ScriptRunner.exe using -appvscript parameter. The scripts run in the order as how we give them. But note we need to add the -wait parameter. If not given the scripts will run without any order.


We can add the -wait, -timeout, -rollbackonerror parameters using the -AppVScriptRunnerParameters to ScriptRunner.exe.It's not mandatory to provide all the -wait, -timeout,-rollbackonerror parameters. We can add them only when needed. But be sure to add -wait parameter if you want the scripts to run in an order to avoid issues.


ScriptRunner.exe can be used in both the DeploymentConfig.xml and the UserConfig.xml files.It can also be used in AppxManifest.xml. To know more about how to export, edit and import the AppxManifest file check here - http://app2pack.blogspot.com/2016/01/add-custom-scripts-in-appxmanifestxml.html

ScriptRunner.exe can be used in all the 8 trigger events both in the MachineScripts and UserScripts section.





To know more check the official TechNet page:
https://technet.microsoft.com/en-us/library/mt346534(v=vs.85).aspx

Friday, February 19, 2016

Thursday, February 18, 2016

UPDATED: Best Practices for Application Virtualization (App-V)

Since previous video had some technical issues, updated the blog with the new one. This webinar is from Steve Thomas explaining current best practices for App-V.



Current Best Practices for Application Virtualization

Watch out the video about current best practices to be followed including PVAD for some applications and other useful stuffs from App-V Legend Steve Thomas





Due to some issues, have updated the video to another link:


http://app2pack.blogspot.com/2016/02/updated-best-practices-for-application.html

Wednesday, February 10, 2016

App-V 5.1 bug or expected behaviour?

Recently I came across a post in TechNet as the scripts added in deploymentconfig.xml file is not getting triggered when using the App-V generated MSI file for publishing in App-V 5.1.


I planned to do a simple test to check this case before giving out confirmation from my end. Below I have compared this scenario between App-V 5.0 SP3 and App-V 5.1 generated MSI's.


App-V 5.0 SP3:

Step 1- Created a virtualized package.
Step 2- Added a script in deploymentconfig.xml file which would do a simple file copy.




Step 3- Ran the App-V 5.0 SP3 generated MSI and found that it is using the deployment config file and triggered the script and copied the file as expected.
Step 4- Reverted the machine to clean state.
Step 5- Edited the deployment config file and removed / in </MachineScripts>



Step 6- Ran the MSI and see the below error.


Step 7- Checked in App-V event log and see the exact reason for failure that tag is not closed properly.


This proves that App-V 5.0 packages use deployment config file.

App-V 5.1:

Step 1- Created a sample virtualized package using App-V 5.1.
Step 2- Performed the same steps like above. Added a script in deploymentconfig.xml file which would do a simple file copy.




Step 3- Ran the MSI and found that it is not using the deployment config file and did not trigger the script. The file wasn't copied like expected.
Step 4- Reverted the machine to clean state.
Step 5- Edited the deployment config file and removed / in </MachineScripts>



Step 6- Ran the MSI and see that it is getting installed successfully. This shouldn't be the case.

This proves that App-V 5.1 has some sort of bug when installed through its generated MSI that it is not using the deploymentconfig.xml like previous App-V 5.0 version or is this the expected one that App-V 5.1 generated MSI will no longer use the deploymentconfig.xml file? Expecting Microsoft App-V Team to give their answer.

UPDATE:


Editing the App-V 5.0 SP3 PackageMsiTemplate.msi in c:\Program Files\Microsoft Application Virtualization\Sequencer\en-us shows that SetPublishPackage32 Customaction has condition set to below.

APPV_OR_MSI_FILE=[APPV_OR_MSI_FILE];APPV_DEPLOYMENTCONFIG=[APPV_DEPLOYMENTCONFIG];APPV_LOCAL=[APPV_LOCAL];MSI_TEMPLATE_REGKEY=Software\Microsoft\AppV\MsiTemplate\[ProductCode]

                  

Editing the App-V 5.0 SP3 sequencer generated MSI with ORCA shows that SetPublishPackage32 Customaction reflects the same as in PackageMsiTemplate.msi


APPV_OR_MSI_FILE=[APPV_OR_MSI_FILE];APPV_DEPLOYMENTCONFIG=[APPV_DEPLOYMENTCONFIG];APPV_LOCAL=[APPV_LOCAL];MSI_TEMPLATE_REGKEY=Software\Microsoft\AppV\MsiTemplate\[ProductCode]

                  

In App-V 5.1:


Editing the App-V 5.1 PackageMsiTemplate.msi in c:\Program Files\Microsoft Application Virtualization\Sequencer\en-us shows that SetPublishPackage32 Customaction has condition set to below.

APPV_OR_MSI_FILE=[APPV_OR_MSI_FILE];MSI_TEMPLATE_REGKEY=Software\Microsoft\AppV\MsiTemplate\[ProductCode]




It is missing APPV_DEPLOYMENTCONFIG=[APPV_DEPLOYMENTCONFIG] property and so App-V 5.1 generated MSI doesn't use the deployment config file while installing in standalone mode.


Many a thanks to App-V Techie Roy Essers for confirming this point.