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.
- 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\[\])
} - In the task scheduler, I had to run the task under my account, for all users with the highest rights.
Trigger:
This event occurs when a profile is unloaded.
Programm: powershell.exe
Arguments: -NoProfile -NoLogo -NonInteractive -ExecutionPolicy Bypass -File C:\PS\FixLockoutProfile.ps1