vql Posted May 18, 2005 Share Posted May 18, 2005 Please view picture. Note: when reinstall Windows, this key will be changed.Because I have .reg to configure my computer (every reinstall Windows, I only run .reg by one mouse click), but there are special values in this key, so I can't add this key into my .reg, because I can't use to configure if I reinstall my Windows. Link to comment Share on other sites More sharing options...
Martin Zugec Posted May 18, 2005 Share Posted May 18, 2005 Well, it is user SID... Easiest way is to use WMI to query the SID for specified user. In vbscript use Win32_UserAccount, in batch/cmd use wmic useraccount where name="username_you_want" get SID Link to comment Share on other sites More sharing options...
craziscoth Posted July 6, 2005 Share Posted July 6, 2005 (edited) I was looking to do something similar in C++ (get the SID for a user to access the HKEY_USERS registry key). I can't use WMI and it needs to work on Windows NT.Any suggestions?---Update---I've gotten the SID using the LookupAccountName function, but am unable to access the HKEY_USERS key for any user other than the one I am currently logged in as.More on what I am trying to do: I am trying to modify the Shell registry key for certain users that may not be currently logged in and not all users on the system.Any ideas? Edited July 7, 2005 by craziscoth Link to comment Share on other sites More sharing options...
craziscoth Posted July 8, 2005 Share Posted July 8, 2005 Getting a bit disheartened by lack of response. From what I've found out so far, the HKEY_USER key isn't available for users not currently logged on. So it appears as if the SID does me no good here. The best solution I've found is to use the API LogonUser and then LoadUserProfile to load the users HKEY_USER registry key and get a handle to it.However this requires having the user password to do the logon which I do not have. Anyone know of a better solution? Link to comment Share on other sites More sharing options...
spiritpyre Posted July 21, 2005 Share Posted July 21, 2005 ...or you could do one easier than that. That key IS {or at least is equivalent to} "HKEY_CURRENT_USER" (which is why if you check the msdn documentation HKCU is listed as a subkey of HKU). If you have to do it the hard way I *think* I remember seeing somewhere on msdn some function that will get the SID value. maybe you could do a search there for 'SID' or 'get SID'.btw you'll also notice that when you make a change via the HKCU key (which has the exact same structure as the HKU\{SID #} ) that when you go back to HKU\{SID #}\whatever its value is now set to whatever you just set in HKCU. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now