Switch a Local profile to Temporary

When building a new (hosted) desktop the question about what profile type to use regularly pops up. The chosen profile type has impact on logon times, performance and manageability.

The use of a UEV or UEM tool for profile virtualization is used in most environments now a days so the choice between a Local and a Mandatory profile has to be made. According to this article of Citrix the difference between a Local Profile and an Mandatory profile is not much.

I prefer to use the Local profile and make it Temporary because with this profile users get a profile that logs on fast, it can’t get corrupted and I don’t have to create and maintain the Mandatory Profile.

A Local Profile is default but to set it to Temporary requires a change in the registry. Changing a profile from Local to Temporary is often called “bitflip”.

Here is a screenshot of the Local Profile, which is default at logon. In this scenario it stays on the system when logging of:

 

image

 

To change the Status from Local to Temporary the following registry key needs to modified:

HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\*SID*\State

In this screenshot the Profile is set to the status Local (598)

image

The value of the State key needs to be changed to value 128.

When using a script, the SID of the user has to be found. The following PowerShell script can be used to write the SID of the current user to a variable and set the State to value 128 (Temporary):

$USERSID = ([Security.Principal.WindowsIdentity]::GetCurrent()).User.Value
[Environment]::SetEnvironmentVariable(‘USERSID’, ($USERSID), ‘User’)

Set-ItemProperty -path Registry::’HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\’$USERSID’\’ -Name State -Value 128

The script must run with administrative credentials because it writes to HKLM.

See this PaseBin site to copy and past the correct code.

In this screenshot the Profile is set to the status 128 (Temporary):

image

 

After the value of Status has changed to Temporary:

image

 

When the user logs off the profile is automatically removed from the system.
UEV/UEM tools will save and inject any personal settings from the user.

Advertisements
This entry was posted in Citrix XenApp, Citrix XenDesktop, Microsoft General, Scripts and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s