[python-win32] HKLM\SOFTWARE\...\ProfileList\... registry subkeyquery

Roger Upole rupole at hotmail.com
Mon Sep 10 19:28:32 CEST 2012


raf wrote:
> Roger Upole wrote:
>
>> raf wrote:
>>
>> > so my questions are:
>> > did the sid for the account name ever uniquely identify the user?
>>
>> Yes. In fact it's the only way, since you can change the login name of an account.
>>
>> > how do i obtain the "1009" that needs to be appended to the sid
>> > to complete it?
>>
>> win32security.LookupAccountName will give you the complete sid for a username.
>>
>>      Roger
>
> if you look at the code i supplied, you'll see that that is precisely
> where i get the sid from:
>
>  sid = win32security.ConvertSidToStringSid(win32security.LookupAccountName(None, username)[0])
>
> so win32security.LookupAccountName is not giving me the complete sid for the username.
> any idea why it isn't doing so? any idea what i'm doing wrong?
>
> cheers,
> raf

Sorry, from a first glance I thought you were deliberately retrieving the machine's SID and then
looking for the accounts under it.  It appears you have a machine named the same as the user,
and the call to LookupAccountName is finding the computer name first.  Try passing
\\machine\username instead of just the bare user name.

       Roger





More information about the python-win32 mailing list