I've built a Windows 2016 XenApp server as a PVS vDisk. I've set up a mandatory profile for the users to log in with. When I boot up my test VM on this vDisk in Standard mode and log in with a domain user, the logon takes about 3 minutes, which is unacceptable. However, every subsequent logon into that is much quicker, about 1 minute - and this is true whichever user logs in, whether it's the same user who logged in first, or another one.
This happens no matter how I log in too - whether over a XenApp published desktop or logging in locally via the XenCenter console screen
This is not due to the logon session remaining in a Disconnected state, because I have the 'Delete cached copies of roaming profiles' Group Policy set, so the profile folder, and the corresponding registry hive, disappears correctly on logoff. Also the Users tab of Task Manager shows that the session is gone.
On that first (slow) logon, here are the sections of the logon process that I feel are taking longer:
# When the username is displayed in the middle of the screen, it shows 'Other user' first for about 10 seconds, before changing to my username.
# It stays on 'Please wait for the user profile service' for about 10 more seconds.
These two stages happen so quickly in subsequent logon that I hardly see them at all. Then, it goes through the Group Policies quite quickly.
# Then it seems to stay on 'Applying user policy' and 'Applying user personalization' for about 15 seconds each (these are both AppSense messages), whereas they take 1-2 seconds each usually. I've tried stopping all AppSense services beforehand, but this doesn't improve the first-logon speed.
# But the part of the logon process that causes the most delay is, after all the logon messages are done, it goes to a black screen with cursor for about 60 seconds, before the desktop clumsily loads.
# I have Skype for Business popping up on logon too, some time after the desktop, and even this takes significantly longer to do so.
Can you suggest how I can begin to troubleshoot this?
One theory:- When I've been building the vDisk (using vDisk versioning) I've never logged into it with a domain user - only as a local admin user. I figured it would help keep the machine clean if I did this - therefore ever time the server boots up on that vDisk in Standard Mode and a domain user logs in, this is the first time a domain user will ever have logged into it. Is it possible that some stuff happens during the first domain user logon that remains set for all domain users, and that I need to capture when I'm updating my vDisk image? I'm guessing this is unlikely considering my test user wouldn't have the permissions to change machine-level settings anyway. But I thought I'd check, because I've seen issues with Windows 10 where the first login after sysprep takes ages.