Thursday, March 17, 2016

AppV5 - Package fails to load with error 0x79100E100-0xC (Starring Procmon)

We were having an issue with a AppV5 package loading and we received the following error message:
Event ID 1008
Package {b8b01729-ed31-4d77-a859-dbd8b82a3372} version {e1d21ac7-84f0-4ab7-998f-e3258be91298} failed configuration in folder 'D:\AppVData\PackageInstallationRoot\B8B01729-ED31-4D77-A859-DBD8B82A3372\E1D21AC7-84F0-4AB7-998F-E3258BE91298' with error 0x79100E10-0xC.

This message is preceeded by this message:
Event ID 4009
machine script for event AddPackage with command line: 'cmd.exe' exited with failure error code: Incorrect function.. Because Rollback is set to true in the script definition, the current AppV Client operation was rolled back.

I started investigating.  The first thing I did was open a powershell window and tried to load the package via the command line:

I then looked at our DynamicDeployment XML file and examined the script it is trying to launch:

The script it's trying to launch looks like this:

Since this is a Machine Script, I started a process monitor capture, executed my command, stopped the capture then used the "Process Tree"

and clicked on AppVClient.exe and clicked "Include Subtree".

 and used the "show process and thread activity".  I filtered on 'Detail' 'Begins with' and set it for both Parent and Exit so I can look at the process path and exit codes:

The 'exit code' is '1' (Exit Status: 1) which means an error occurred that caused the script to fail.  So now we dive into that script and see why it's failing:

From looking at the script, it's trying to create a new 'mklink' path.  If I try and run this command manually, I get the following:

So this is where the errorlevel (also exit code) is being set.  The last error level is 1 which becomes the exit code once the script runs 'EXIT.

So, there are two methods I can think of to solve this problem.

1) I can set EXIT /B 0 to always set EXIT to report and error code of '0'.
2) Check to see if the path already exists and then EXIT

I chose to modify the script to exit if the path exists.  I changed it like so:

I cleared procmon, set it to trace again and attempted to run the add-appvclientpackage command again.

I selected 'AppVClient.exe' and clicked 'Include Subtree'

This time we can see that the 'AHS-ATOP.cmd' script has an 'Exit Status: 0' which means it completed successfully.  But, the next script, 'AHS-SoftWorksGroup-ScreenTestIII.cmd' with the parameter 'INSTALL' fails with 'Exit Status: 1'.  Again, we look into the script...

We can see it has the same flaw.  I then modified the script to add the same IF EXISTS check.  I then cleared procmon and reattempted to add the package.


Hurray!  The package loaded and the scripts ran correctly.

 An alternative to all of this is I could have changed the 'rollback' to 'false' in the DeploymentConfig.xml file, but I would rather the package *not* load if the 'INSTALL' script fails for whatever reason.  This ensures an error is generated that needs to be dealt with rather than potentially having a half-working package.  These INSTALL scripts were simple enough that a simple directory check would suffice to ensure it's working and that's what I've done.

1 comment:

Vigneshwaran said...

As always, interesting troubleshooting tips from you :)