Profile Trasher

Profile Trasher is a Powershell script that deletes cached Windows 2016 Local User Profiles at logoff, ensuring that users get a brand new User Profile at every logon. Profile Trasher is intended for environments where a roaming User Profile Management solution is not required or when using Pseudo / Hybrid Mandatory Profiles.

Profile Trasher is intended for use on Citrix XenApp Servers running Windows 2016 Server. It could also be used on Windows 10 'Kiosk' PCs.

Problem:

  • Start Menu stops working.
  • Start Menu has to be clicked twice to display.
  • Start Menu right click context menu stops working.

Symptoms:

Application Log: Event ID: 5973 - Activation of app Microsoft.Windows.ShellExperienceHost_cw5n1h2txyewy!App failed with error: The application cannot be started because it is currently updating. See the Microsoft-Windows-TWinUI/Operational log for additional information.

System Log: Event ID: 10001 - Unable to start a DCOM Server: App as Unavailable/Unavailable. The error: "15616" Happened while starting this command: "C:\windows\SystemApps\ShellExperienceHost_cw5n1h2txyewy\ShellExperienceHost.exe" -ServerName:App.AppXtk181tbxbce2qsex02s8tw7hfxa9xb3t.mca

Microsoft-Windows-TWinUI/Operational Log: Event ID: 5990 - Activation via contract helper of the app Microsoft.Windows.ShellExperienceHost_cw5n1h2txyewy!App for the Windows.Launch contract failed with The application cannot be started because it is currently updating.

Microsoft-Windows-TWinUI/Operational Log: Event ID: 5975 - Activation of the app Microsoft.Windows.ShellExperienceHost_cw5n1h2txyewy!App for the Windows.Launch contract was blocked because its package is being updated.

Microsoft-Windows-TWinUI/Operational Log: Event ID: 5985 - ActivateApplicationForContractByAppIdAsUserWithHost of the app Microsoft.Windows.ShellExperienceHost_cw5n1h2txyewy!App for the Windows.Launch contract failed with The application cannot be started because it is currently updating.

Cause:

When a user logs on with a Local Profile or a Template Profile, the following registry keys are created using the user SID .

  • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AppReadiness\<SID>
  • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Appx\AppxAllUserStore\<SID>

If you are using 'Profile Spoofing' to flag the User Profile as a 'Guest' account using a logon / logoff script, then these registry keys are not deleted along with the user profile. When the user logs onto the same Citrix XenApp server, the Windows Start Menu and other Modern apps will likely become unstable and eventually stop working.

Profile Spoofing is common when using hybrid profiles that do not require the entire user profile to roam, and a new user profile is created at each logon.

This is unlikely to be an issue when using Citrix XenDesktop because by default a desktop O/S virtual machine will reboot at logoff so the HKLM registry keys get cleaned up following the reboot. However when using Citrix XenApp each XenApp server may not reboot for a number of days therefore if a user establishes a second logon on a server where the user has previously logged on, then Start Menu issues may arise.

Solution:

Copy the TrasherV1.ps1 script to a local folder (C:\Windows) on you Master XenApp virtual machine.

Create a Scheduled Task with the following properties:

Trigger:

Action: Start a Program

Program: Powershell.exe

Argument: -ExecutionPolicy ByPass -NoProfile -File C:\Windows\TrasherV1.ps1

Related Articles :

Using Environment Manager to flip profile state and delete roaming/local profiles

Start Menu Stops Responding On Windows 10 or Windows 2016 VDA While Using UPM

Start Menu Left Click is not Working on Windows 10 and Server 2016