brNwsH Posted August 19, 2011 Share Posted August 19, 2011 Hey Com, i need 2 change a registry key on 200 clients but its unfortunately under HKEY_Users. so i searched the forum and found some scripts to read the users SID but it doesnt return the right SID $UserSID = _GetSID() MsgBox (1, "test", $UserSID) Func _GetSID($sComputerName = @ComputerName, $sUsername = @UserName) Local $oWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!//" & $sComputerName & "/root/cimv2") Local $oColItems = $oWMIService.ExecQuery("Select * From Win32_UserAccount") If IsObj($oColItems) Then For $oObjectItem In $oColItems If $sUsername = $oObjectItem.Name Then Return $oObjectItem.SID EndIf Next EndIf Return SetError(1, 0, 0) EndFunc ;==>_GetSID It is returning "S-1-5-21-2929902127-4284358396-3866876256-500" but my SID in the reg is "S-1-5-21-535800494-807093659-1863580331-500" so where is the problem. thx brN Link to comment Share on other sites More sharing options...
hannes08 Posted August 19, 2011 Share Posted August 19, 2011 Hm... works fine for me. What I can see from your SID is that you've got a completely different DOMAIN/Workstation identifier. Just a question: why do you want to get the SID of the current user if you could use the "HKCU" reg hive? Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler] Link to comment Share on other sites More sharing options...
brNwsH Posted August 22, 2011 Author Share Posted August 22, 2011 i use a registry monitor and it only showed the change in the HKU not in the HKCU but after you mentioned it i took a closer look and the key is written in the HKCU too. thx 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