Tuesday, May 30, 2006

Citrix Tips: Convert object name to SID and vice versa

Very often users' cached profile become corrupt on Citrix server(s) and needs to be deleted, but that profile's registry hive remains loaded into memory even after the user has logged off. This prevents the deletion of that user's profile until the server is restarted. There is, however, a workaround to manually unload that user's registry hive. In REGEDIT.EXE or REGEDT32.EXE, all the active logged on users have their registry hive loaded into memory under HKEY_USERS represented by their user's SIDs (not the actual user names). If there are hundred of users logged-in on a server, and one particular registry hive needs to be unloaded which belongs to that user's profile, the best way is to find that user's SID and search that SID under HKEY_USERS and unload that hive.

PsGetSid from sysinternals can be used for converting user name into SID.

Convert Name to SID: http://www.sysinternals.com/Utilities/PsGetSid.html
Example: C:\> psgetsid <user_id>

Conversly, SidToName from Joeware Tools can be used for coverting SID into User ID.

Convert SID to Name: http://www.joeware.net/win/free/tools/sidtoname.htm
Example: C:\> sidtoname <S-1-5-21-xxxxxxxxx-xxxxxxxxx-xxxxxxxxxx-xxxxxx>

UPDATED: >PsGetSid can convert SID to name as well, so you just need PsGetSID to covert name to SID and vice-versa.

1 comment:

citrix tips said...

this is useful to know, I was performing housekeeping on one of my servers and I was wondering how to work out which sid was for which user.

Also to help with user log on and offs install microsofts user hive