Error popup with PSADT running in silent mode

Hi all, we are experiencing an error popup for users when running PSADT in silent mode and are wondering how to suppress this popup.

[Pre-Installation] :: Error Record:

Message : Removal failed. Please contact your software vendor.

             Deployment DeStage operation with target volume C: on Package 
             Microsoft.Microsoft3DViewer_7.2105.4012.0_x64__8wekyb3d8bbwe from:   failed with error 0x80070002. 
             See http://go.microsoft.com/fwlink/?LinkId=235160 for help diagnosing app deployment issues.

InnerException :

FullyQualifiedErrorId : System.Runtime.InteropServices.COMException,Microsoft.Windows.Appx.PackageManager.Commands.Remo
veAppxPackageCommand
ScriptStackTrace : at , C:\WINDOWS\ccmcache\1r\Deploy-Application.ps1: line 161
at , : line 1
at , : line 1

PositionMessage : At C:\WINDOWS\ccmcache\1r\Deploy-Application.ps1:161 char:37
+ $InstalledUserApp | Remove-AppxPackage -AllUsers
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

[Pre-Installation] :: Display Dialog Box with message: Error Record:

Message : Removal failed. Please contact your software vendor.

             Deployment DeStage operation with target volume C: on Package 
             Microsoft.Microsoft3DViewer_7.2105.4012.0_x64__8wekyb3d8bbwe from:   failed with error 0x80070002. 
             See http://go.microsoft.com/fwlink/?LinkId=235160 for help diagnosing app deployment issues.

InnerException :

FullyQualifiedErrorId : System.Runtime.InteropServices.COMException,Microsoft.Windows.Appx.PackageManager.Commands.Remo
veAppxPackageCommand
ScriptStackTrace : at , C:\WINDOWS\ccmcache\1r\Deploy-Application.ps1: line 161
at , : line 1
at , : line 1

PositionMessage : At C:\WINDOWS\ccmcache\1r\Deploy-Application.ps1:161 char:37
+ $InstalledUserApp | Remove-AppxPackage -AllUsers
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Would the answer be to remark out the line “Show-DialogBox -Text $mainErrorMessage -Icon ‘Stop’” line in the “##* END SCRIPT BODY” section? If so perhaps some logic should be added to not display a messagebox if running in silent mode.

Maybe but it seems like your line 161 is the issue.
If the following is your line 161:

$InstalledUserApp | Remove-AppxPackage -AllUsers

I suspect the problem is what’s in $InstalledUserApp .
Is it empty? Is it good?
We can’t tell because you skimped on the logging.

See below on how to add it to the Remove-AppxPackage command:

As for determining what’s in $InstalledUserApp , you might be able to add an additional line before line 161 to log its contents. I’m assuming it’s an array so this should work:

Write-log "Contents of InstalledUserApp [$($InstalledUserApp | Out-string)]"

The root cause of the error is because an appx package is failing to be removed, I wanted to focus this post about a UI prompt coming up in silent mode which isn’t desired.

Here is the simplified PS code for the appx uninstall:
$ProvisionedAppName = ‘Microsoft.Microsoft3DViewer’
Get-AppxPackage -Name $UserAppName -AllUsers
ForEach ($InstalledUserApp in $InstalledUserApps)
{$InstalledUserApp | Remove-AppxPackage -AllUsers}

This step is failing -
Message : Removal failed. Please contact your software vendor.

             Deployment DeStage operation with target volume C: on Package 
             Microsoft.Microsoft3DViewer_7.2105.4012.0_x64__8wekyb3d8bbwe from:   failed with error 0x80070002. 
             See http://go.microsoft.com/fwlink/?LinkId=235160 for help diagnosing app deployment issues.

Your MS Store is corrupt:
https://duckduckgo.com/?t=ffab&q=Remove-AppxPackage+error+0x80070002

It’s possible, although my primary concern was the popup when PSADT is being run silently. We have remarked out the line “Show-DialogBox -Text $mainErrorMessage -Icon ‘Stop’” line in the “##* END SCRIPT BODY” and it seems to have done the trick.

We have a separate app that installs per user the latest appx package, once that occurs the old one is removed correctly.

1 Like