My daily business is software deployment, software packaging, installation automation. In order to do so it is often required to put some datas into the userprofile(s) that is (are) currently logged on to the system.
To avoid a logoff (for example when installing via SCCM or other deployment tools) i want to create a little tool that is going to update the current user profile straight away.
(for your info: When deploying an app the current user is a SYSTEM account! NOT the CU of the System)
For now we used a vb script that enumartes through HKEY_USERS, find all SIDS with a "Volatile Environment-Key" and update those (you can get to the profiles folder from this key on too, not only registry).
As this key is not documented and I am writing a C#-App I want to do it properly. Now that seems to be a problem :) In order to "do it properly" I'm supposed to use SHGetKnownFolderPath (Vista and up). There I need the Token of the Users. Which I am not able to get for all logged on users: Only the current user is passed by using System.Security.Principal.WindowsIdentity.GetCurrent(); LsaEnumerateLogonSessions wont give me the needed information and to get a token of a users via WTSQueryUserToken oder others I need higher privleges (LOCAL SYTEM).
That's why I am asking if ANY of you has got an idea that is going to work without a big "walk to the moon and back". I know there are solutions like increasing the privileges and other dirty stuff but if there is another way I'd like to go for it :)
Thanks very much!