FsLogix - Unclean logoff causing locked files until server reboot

Much R 101 Reputation points
2021-01-13T16:29:50.18+00:00

Problem is described by M4deman under unclean-logoff-causing-locked-files-until-server-reboot

It seems to have something to do with the 2009 version.
The latest version of FSLogix is installed whats-new

Description

After a user logoff, the "System" Process (PID 4) locks the following folders:

C:\Users\local_username\AppData\Local\Microsoft\Credentials
C:\Users\local_username\AppData\Roaming\Microsoft\Credentials

The user is completely logged of, according to Task Manager.

In the FSLogix Profile Log file I can see the following:

[07:53:55.601][tid:00000c90.0000ce44][ERROR:00000020] Delete profile failed for sid S-1-5-21-3364776539-3721753400-1968955100-1179, Cleaning up manually. (Der Prozess kann nicht auf die Datei zugreifen, da sie von einem anderen Prozess verwendet wird.)
The last sentence means that the process cannot access the file, because another process already uses it.

Also the whole "local_username" folder cannot be deleted:

[08:23:15.479][tid:00000c90.0000bcc4][WARN: 00000005] Failed to delete C:\Users\local_usename (Access is denied)
Access Denied

Does someone have any info on this behaviour?

Remote Desktop
Remote Desktop
A Microsoft app that connects remotely to computers and to virtual apps and desktops.
4,551 questions
FSLogix
FSLogix
A set of solutions that enhance, enable, and simplify non-persistent Windows computing environments and may also be used to create more portable computing sessions when using physical devices.
493 questions
{count} votes

106 answers

Sort by: Most helpful
  1. owen osborne 1 Reputation point
    2021-11-30T16:34:01.703+00:00

    Using the latest version of fslogix we suffer the same problem on our rds 2012r2 servers and have done through various releases.
    If you have the GPO setting to remove the local profiles at log off the profile will be trashed and we will find file locks on local search folders. Causing a profile error.
    "C:\Users\username\AppData\Roaming\Microsoft\Search\"

    You can use delprof to remove the profile cleanly
    you can stop search to remove the lock

    As a all in one solution i disable the GPO that removes the local profile. Then on on a nightly schedule stop the search services, disable the search services. Have delprof run. Rinse and repeat a few times.

    by the morning previous sessions are cleaned off so new sessions work fine.
    Works 95% of the time.

    0 comments No comments

  2. Андрей Михалевский 3,201 Reputation points
    2021-12-08T06:57:17.86+00:00

    It's been a year now, and Microsoft doesn't want to solve the problem. I don't know what's wrong with them.

    I temporarily fixed this problem with a script in the task scheduler.

    1. On each RDSH server I created a folder C:\PS and put this script there: $Event = Get-WinEvent -MaxEvents 1 -FilterHashtable @{logname='Microsoft-FSLogix-Apps/Operational';ID='31'} $TimeCreated = $Event.TimeCreated $Event = [xml]$Event.ToXml() $User = $Event.Event.EventData.Data | Where-Object {$.name -eq "Username"}
      $SID = $Event.Event.EventData.Data | Where-Object {$
      .name -eq "SID"} $RefCount = (Get-ItemProperty -Path "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileService\References\$($SID."#text")").RefCount[0] if( $RefCount -ne 0 )
      {
      "$TimeCreated, $($User.""#text""), $($SID."#text"), $($env:COMPUTERNAME)" | out-file \resoleasing.com\NETLOGON\RDS\FSLogix\FSlogix.txt -Append
      Set-ItemProperty -Path "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileService\References\$($SID."#text")" -Name RefCount -Value (byte\[\])
      }
    2. In the task scheduler, I had to run the task under my account, for all users with the highest rights.

    Trigger:

    large

    This event occurs when a profile is unloaded.

    Programm: powershell.exe

    Arguments: -NoProfile -NoLogo -NonInteractive -ExecutionPolicy Bypass -File C:\PS\FixLockoutProfile.ps1

    0 comments No comments

  3. Martijn Kools 151 Reputation points
    2021-12-09T14:15:17.45+00:00

    I have two Citrix environments which are pretty much identical. Both 2019 Citrix LTSR 1912 CU4. One has the issue the other one doesn't and profiles get cleaned up nicely. They both run 2105 HF1 and share the same redirections.xml file and container storage location.

    On the not working I get these errors:

    [14:57:43.138][tid:00001770.0000407c][WARN: 00000091] Failed to delete C:\Users\local_BURNESKA (The directory is not empty.)
    [14:57:43.142][tid:00001770.0000407c][WARN: 00000005] Failed to delete C:\Users\local_cvetanom (Access is denied.)

    The VHDX gets unmounted though, so the user can still re-logon. It just doesn't delete the temporary local_data.
    When I try to delete the content from local_user myself I get an access denied. I tried spawning a CMD as SYSTEM but same thing, access denied. There is no way you can delete that folder. I'm running non-persistent disks though, so reboot and it's gone but it's still annoying enough.

    My other Citrix env has no issues at all, it can run for weeks and all profiles are cleaned up perfectly fine! So wth is the difference :)

    0 comments No comments

  4. Sues, Marco 1 Reputation point
    2021-12-13T15:37:10.893+00:00

    We got the same issue with Windows 2019, FSLogix 2105 HF_01 (2.9.7979.62170) and CVAD 1912 CU4.

    (latest kb installed, cleanupinvalid Sessions key set..)

    I have read in some Posts, that a downgrade worked for some of you guys. Which Version did you chose in this Case?

    Also someone wrote uninstalling UPM worked for someone..

    If we want to open a case with MS on this Problem, does someone have a link for this?

    Greetings Marco


  5. Андрей Михалевский 3,201 Reputation points
    2022-01-13T09:25:58.987+00:00

    Hi. What's new? Still no fix. Does anyone do paid tickets, do they help you?

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.