Answered by:
App-V 5 scripts not running

Question
-
Can someone clue me in on the secret to getting scripts to run in App-V 5? Ive tried several different scripts and cant get anything to run.
My client shows that package scripts are enabled.
userscripts in my User_config are not commented out.
Ive tried:
<UserScripts>
<StartProcess RunInVirtualEnvironment="true">
<Path>c:\windows\system32\wscript.exe</Path>
<Arguments>\\server\share$\test.vbs</Arguments>
<Wait RollbackOnError="true" />
</StartProcess>
</UserScripts><UserScripts>
<PublishPackage>
<Path>%windir%\system32\notepad.exe</Path>
<Arguments></Arguments>
<Wait RollbackOnError="true" Timeout="30"/>
</PublishPackage>
</UserScripts><UserScripts>
None of the scripts appear to run and I see nothing in the APP-V events logs that even mention the scripts.m The apps do get published and run. What am I missing?
<StartVirtualEnvironment RunInVirtualEnviornment=”false”>
<Path>%SYSTEMROOT%\System32\CMD.EXE</Path>
<Arguments>/K “\\server\share$\Map.bat”</Arguments>
</StartVirtualEnvironment>
</UserScripts>Monday, February 25, 2013 3:03 PM
Answers
-
I discovered atleast one reason my scripts were not working. It looks like publishing an app does not throw an error if your config file is corrupt unless you explicilty set which config file to use. Anotherwords when you publish, it uses the machine and user config files stored with the app. If the user config is corrupt, it will try to apply it, fail, and not tell you it is invalid. If you had specified that same user config with –DynamicUserConfigurationPath, it does tell you its invalid. Im my case I had a typo in the user config. The script didnt appear to be running and other changes in the user config were not getting applied but I wasnt getting any error messages when I published. When I specified that same user config using –DynamicUserConfigurationPath, it told me it was invalid. Once I fixed the typo the user config started working again.
- Proposed as answer by Aaron.ParkerModerator Wednesday, February 27, 2013 1:56 PM
- Marked as answer by Aaron.ParkerModerator Sunday, April 14, 2013 10:44 AM
Wednesday, February 27, 2013 1:36 PM -
And here is another reason my scripts were not working. Some of the scripts in the sequencing guide do not work. The script below is from the guide and it has 2 problems. Environment is spelled wrong and the open and close quotes will not work, it has to be standard quotes "" not ””.
<StartVirtualEnvironment RunInVirtualEnviornment=”false”>
<Path>%SYSTEMROOT%\System32\CMD.EXE</Path>
<Arguments>/K “\\appvserver\content\Map.bat”</Arguments>
</StartVirtualEnvironment>
- Edited by Dave Dewire Wednesday, February 27, 2013 2:21 PM
- Marked as answer by Aaron.ParkerModerator Sunday, April 14, 2013 10:44 AM
Wednesday, February 27, 2013 2:20 PM
All replies
-
Have you enabled script execution on the client? (HKLM\Software\Microsoft\AppV\Client\Scripting EnablePackageScripts = 1)
Falko
Monday, February 25, 2013 3:12 PMModerator -
Yes as I had already mentioned, package scripts are enabled.Monday, February 25, 2013 3:14 PM
-
I have also tried machine scripts and cant get them to run either. Even trying to run something local doesnt seem to work. I do have admin rights and UAC is not enabled.
<MachineScripts>
Name Value SetByGroupPolicy
<PublishPackage>
<Path>c:\test.exe</Path>
<Arguments></Arguments>
<Wait RollbackOnError="true" Timeout="30"/>
</PublishPackage>
<AddPackage>
<Path>c:\test.exe</Path>
<Arguments></Arguments>
<Wait RollbackOnError="true" Timeout="30"/>
</AddPackage>
</MachineScripts>
---- ----- ----------------
PackageInstallationRoot %programdata%\App-V False
PackageSourceRoot False
LocationProvider False
AutoLoad 1 False
EnablePackageScripts 1 False
ReestablishmentInterval 5 False
ReestablishmentRetries 3 False
CertFilterForClientSsl LOCAL_MACHINE\MY\1.3.6.1.5.5.7.3.2 False
VerifyCertificateRevocationList 1 False
SharedContentStoreMode 0 False
MigrationMode 0 False
RoamingFileExclusions False
RoamingRegistryExclusions SOFTWARE\CLASSES False
AllowHighCostLaunch 0 False
IntegrationRootUser %LOCALAPPDATA%\Microsoft\AppV\Client... False
IntegrationRootGlobal %ALLUSERSPROFILE%\Microsoft\AppV\Cli... False
VirtualizableExtensions exe,com,bat,cmd,vbs,ps1,cpl,jar,wsf,... False
ReportingEnabled 0 False
ReportingStartTime False
ReportingRandomDelay False
ReportingInterval False
ReportingServerURL False
ReportingDataCacheLimit False
ReportingDataBlockSize False
ExperienceImprovementOptIn 0 FalseMonday, February 25, 2013 4:25 PM -
Monday, February 25, 2013 4:26 PM
-
Thats an excellent question. It was my understanding that is was possible to apply a specific config file to a package but I thought it was always using the config files that were with the package unless you specified otherwise.
I did try specifying the user config and the script still does not run.
Add-AppvClientPackage "\\server\share$\test\test.appv" | Publish-AppvClientPackage –DynamicUserConfigurationPath "\\server\share$\test\test_userconfig.xml"
<UserScripts>
<StartProcess RunInVirtualEnvironment="false">
<Path>C:\test.exe</Path>
<Arguments></Arguments>
<Wait RollbackOnError="true"/>
</StartProcess>
</UserScripts>Monday, February 25, 2013 6:59 PM -
Hello,
Was there an event that the config-file was successfully applied?
<UserScripts> <StartProcess RunInVirtualEnvironment="true"> <Path>VFS\ProgramFilesX86\App\dosomething.exe</Path> <Arguments>-WithArgs</Arguments> <Wait RollbackOnError="true"/> <ApplicationId>[{AppVPackageRoot}]\Contoso\ContosoApp.EXE</ApplicationId> </StartProcess>
</UserScripts>
The above is an example of howto do it - you are missign several parts of it. For example the ApplicationID - which needs to match the application that will trigger the script
Nicke Källén | The Knack| Twitter: @Znackattack
- Edited by znack Monday, February 25, 2013 7:21 PM
Monday, February 25, 2013 7:10 PM -
It looks like the machine and user config files are automatically applied unless you specify other files to use.
ApplicationId is apparently required for StartProcess and I was finally able to get that one working. I was also able to get the StartVirtualEnvironment script working although I have no idea why it wasnt working before.
I still cant the PublishPackage script to work, no idea why.
Monday, February 25, 2013 8:42 PM -
I discovered atleast one reason my scripts were not working. It looks like publishing an app does not throw an error if your config file is corrupt unless you explicilty set which config file to use. Anotherwords when you publish, it uses the machine and user config files stored with the app. If the user config is corrupt, it will try to apply it, fail, and not tell you it is invalid. If you had specified that same user config with –DynamicUserConfigurationPath, it does tell you its invalid. Im my case I had a typo in the user config. The script didnt appear to be running and other changes in the user config were not getting applied but I wasnt getting any error messages when I published. When I specified that same user config using –DynamicUserConfigurationPath, it told me it was invalid. Once I fixed the typo the user config started working again.
- Proposed as answer by Aaron.ParkerModerator Wednesday, February 27, 2013 1:56 PM
- Marked as answer by Aaron.ParkerModerator Sunday, April 14, 2013 10:44 AM
Wednesday, February 27, 2013 1:36 PM -
And here is another reason my scripts were not working. Some of the scripts in the sequencing guide do not work. The script below is from the guide and it has 2 problems. Environment is spelled wrong and the open and close quotes will not work, it has to be standard quotes "" not ””.
<StartVirtualEnvironment RunInVirtualEnviornment=”false”>
<Path>%SYSTEMROOT%\System32\CMD.EXE</Path>
<Arguments>/K “\\appvserver\content\Map.bat”</Arguments>
</StartVirtualEnvironment>
- Edited by Dave Dewire Wednesday, February 27, 2013 2:21 PM
- Marked as answer by Aaron.ParkerModerator Sunday, April 14, 2013 10:44 AM
Wednesday, February 27, 2013 2:20 PM