Hey Folks,
after appearance of the following Error at one of my customer, I decided to automate the Repair in Case of applying the Solution to many different Terminalservers remote.
The Error we get was the following:
Windows could not start the Microsoft App-V Client on Local Computer. For more information, review the System Event Log. If this is a non-Microsoft service, contact the service vendor, and refer to service-specific error code 3.
You’ll also see an event similar to the following:
Log Name: System
Source: Service Control Manager
Event ID: 7024
Level: Error
User: N/A
Description: The Microsoft App-V Client service terminated with service-specific error The system cannot find the path specified..
Event Xml:
7024
CAUSE
Generally we see these errors when App-V packages are manually deleted from the App-V cache (C:\Programdata\App-v). To demonstrate this, I reproduced this in my environment by deleting packages from the App-V cache and then taking a Process Monitor trace of “APP-V Client Service”. As seen below, we get ‘PATH NOT FOUND’ instances for the missing packages.
Note that the App-V cache is not the only locations where information about packages is stored; it is also stored in the registry at this location:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\AppV\Client\Packages
Here’s what they looked like on my computer:
Although I deleted the packages from the App-V cache, the information in the registry hive still exists, thus Appvclient.exe is trying to write data to the cache and getting the error ‘PATH NOT FOUND’.
RESOLUTION
If for whatever reason you manually deleted packages from the App-V cache, you need to be sure to remove the information regarding the same App-V packages from the registry hive at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\AppV\Client\Packages
Keep in mind that Microsoft does not normally recommend that you delete anything from the App-V cache, however if you find yourself in a situation where you need to do this, we have steps on how to do it in the KB article below.
KB2768945 – How to remove a cached copy of an unpublished package in Microsoft App-V v5 (http://support.microsoft.com/kb/2768945)
NOTE: THESE STEPS SHOULD ONLY BE IMPLEMENTED IN THE SCENARIO WHERE PACKAGES ARE DELETED FROM THE APP-V CACHE. IT IS HIGHLY RECOMMENDED TO VERIFY WHETHER PACKAGES ARE DELETED FROM THE APP-V CACHE BEFORE PERFORMING THE ACTION PLAN ABOVE.
Thanks to Keshav Deo Jain, who detect this error and solution! (https://blogs.technet.microsoft.com/appv/2014/09/03/support-tip-the-app-v-client-service-fails-to-start-and-logs-event-id-7024/)
So why to automate? My Customer got the problem described with many of it’s Terminalservers (about 40 Servers). Because of this I automate the Solution described by Keshav with PowerShell:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#———————————————————————–# | |
# Scriptname: App-vRepairClientCache # | |
# Creator: Matthias Meißner – Login Consultants Germany GmbH # | |
# Date: 2017/04/13 # | |
# Actual Ver.: 0.0.0.4 # | |
# Version History: # | |
# 0.0.0.1 MM Initial Version by Matthias Meißner # | |
# 0.0.0.2 MM Add Remove-AllPermissions Function # | |
# 0.0.0.3 MM Add Foreach-Loop to read Data from CSV # | |
# 0.0.0.4 MM Add Foreach-Loop and Read WMI to delete users Cache # | |
#———————————————————————–# | |
# Description: # | |
# Script is reading CSV File including Server FQDN and reset ACL for # | |
# App-V Client Cash to delete cash. # | |
#———————————————————————–# | |
# CSV File must be located in same directory as the running script and must be structured like this: | |
# | |
# Servername | |
# Server1 | |
# Server2 | |
# …… | |
#Declare Variables (you have to configure the following two Variables to meet requirements of your own infrastructure) | |
$Username = 'Domainname\executionAccountname' | |
$KnownFolders = 'App-VCachefolder' | |
#Import App-V Module | |
Import-Module “C:\Program Files\Microsoft Application Virtualization\Client\AppvClient\AppvClient.psd1” | |
#Import CSV | |
$Servers = Import-CSV '.\Import.csv' –Delimiter ';' | |
#Run Remote Powershell Command for each Server defined in CSV | |
foreach ($Servername in $Servers) { | |
$takename = $Servername.Servername | |
Invoke-Command –ComputerName $takename –ScriptBlock { | |
Function Remove-AllPermissions () { | |
Param( | |
$Folders | |
) | |
BEGIN { | |
$FunctionName = $myinvocation.mycommand.name | |
Write-Host "$FunctionName – Removes permissions from given directory – START" | |
} | |
PROCESS { | |
$acls = Get-Acl –path $folders | |
$outputObject = @() | |
Write-Host "$FunctionName – removing permissions from folder $Folders" | |
Foreach($acl in $acls) { | |
$folder = (convert-path $acl.pspath) | |
Foreach($access in $acl.access) { | |
$acl.RemoveAccessRule($access) | Out-Null | |
} # end foreach access | |
Set-Acl –path $folder –aclObject $acl | |
$i++ | |
} | |
} | |
end{Write-Host "$FunctionName – Removes permissions from given directory – Finish"} | |
} | |
Write-Host 'Permissions will be set….:' | |
Remove-AllPermissions ($KnownFolders) | |
Write-Host 'Stopping App-V Client Service….' | |
net stop AppVClient | |
Write-Host 'Remove Client Packages….' | |
Get-AppvClientPackage –All | Remove-AppVClientPackage | |
Write-Host 'Stopping App-V Client Service….' | |
net stop AppVClient | |
Write-Host 'Delete Registry Hive: HKLM:\SOFTWARE\Microsoft\AppV\Client\Packages' | |
Remove-Item –Path HKLM:\SOFTWARE\Microsoft\AppV\Client\Packages –force –recurse | |
Set-Location –Path env: | |
Write-Host 'Removing App-V5 Client Cache directory' | |
Remove-Item ($KnownFolders + '*') –recurse | |
Write-Host 'Get all user accounts loaded locally…' | |
$loggedonUsers = Get-WmiObject –Class Win32_UserAccount | |
foreach ($Name in $loggedonUsers) { | |
$handleuser = $Name.Name | |
Write-Host "User AppData for User '$handleuser' will be deleted" | |
$beginningstring = 'C:\Users\' | |
$UserAppData = $beginningstring + $handleuser + '\AppData' | |
$PathCatalog = "$UserAppData\Roaming\Microsoft\AppV\Client\Catalog\Packages" | |
$PathRoamingVFS = "$UserAppData\Roaming\Microsoft\AppV\Client\VFS" | |
$PathINT = "$UserAppData\Local\Microsoft\AppV\Client\Integration" | |
$PathClientVFS = "$UserAppData\Local\Microsoft\AppV\Client\VFS" | |
if (Test-Path $PathCatalog){ | |
Write-Host "Deleting the App-V Catalog Path for User $handleuser" | |
$PathCatalogfinal = $PathCatalog + '\*' | |
Remove-Item $PathCatalogfinal –recurse | |
} else { Write-Host "Path to App-V Catalog for User $handleuser does not exist"} | |
if (Test-Path $PathRoamingVFS){ | |
Write-Host "Deleting the App-V Roaming VFS Path for User $handleuser" | |
$PathRoamingVFSfinal = $PathRoamingVFS + '\*' | |
Remove-Item $PathRoamingVFSfinal –recurse | |
} else { Write-Host "Path to App-V Roaming VFS for User $handleuser does not exist"} | |
if (Test-Path $PathINT){ | |
Write-Host "Deleting the App-V Integration Path for User $handleuser" | |
$PathINTfinal = $PathINT + '\*' | |
Remove-Item $PathINTfinal –recurse | |
} else { Write-Host "Path to App-V Integration for User $handleuser does not exist"} | |
if (Test-Path $PathClientVFS){ | |
Write-Host "Deleting the App-V Client VFS Path for User $handleuser" | |
$PathClientVFSfinal = $PathClientVFS + '\*' | |
Remove-Item $PathClientVFSfinal –recurse | |
} else { Write-Host "Path to App-V Client VFS for User $handleuser does not exist"} | |
} | |
Write-Host 'Starting App-V Client Service….' | |
net start AppVClient | |
Write-Host 'Get App-V Publishing Server and starting sync….' | |
Get-AppvPublishingServer | Sync-AppvPublishingServer | |
} –credential $Username | |
} |
https://gist.github.com/anonymous/d7dd57c6f4b1dd0c412fdd4638d63bc7.js
Good information. Deleting the cache from programdata\microsoft\appv\packages and Reg key from “HKLM:\SOFTWARE\Microsoft\AppV\Client\Packages” resolved my issue.
It was issue with 2016 server, where appvclient services was not starting.
Thanks again 🙂
LikeLike