brNwsH 0 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 Share this post Link to post Share on other sites
hannes08 39 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] Share this post Link to post Share on other sites
brNwsH 0 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 Share this post Link to post Share on other sites