Yes they are..  Sids for the user...  The textual sid..  Not the binary
one.

Here's some dusty code, but it should work for what you want.  I just
tested it and it still works..  :)

print "SID =
".ConvertSID("username","DOMAINNAME","\\\\DOMAINCONTROLLER");

sub ConvertSID {
  my $Login=shift;
  my $Domain=shift;
  my $PDC=shift;
  if (Win32::LookupAccountName($PDC, $Login, $Domain, $SID_Binary,
$SID_Type)) {
    my($Revision, $SubAuthorityCount, @IdentifierAuthorities) =
unpack("CCnnn", $SID_Binary);
    my($temp, $temp2, @SubAuthorities) =
unpack("VVV$SubAuthorityCount",$SID_Binary);
    return
$_="S-$Revision-$IdentifierAuthorities[2]-".join("-",@SubAuthorities);
  } else {
    print "ERROR IN SID: ",Win32::FormatMessage(Win32::GetLastError());
    return 0;
  }
}

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Steven Satelle
Sent: Wednesday, November 10, 2004 8:24 AM
To: [EMAIL PROTECTED]
Subject: Get SId


I have a (hopefully) simple silly question. I have a need to modify
peoples registry using perl. But, our domain policy denies access to
the registry. Which means I need to su in order to do it. Now if I su,
I cant access Current_User anymore (well I can but its the CU for the
wrong person). I know that CU is only a symlink to
Hkey_Users\<subFolder>. I though that those long Sid like folder names
were the sids of the users but, they're not. How would I find out
which folder is the one for the user I'm looking for?
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to