Title: RE: Code to get Administrators group name from SID

Well, what about it? Is anybody interested in this?


-----Original Message-----
From: [EMAIL PROTECTED] on behalf of Brauer, Jan
Sent: Thu 8/19/2004 3:24 PM
To: [EMAIL PROTECTED]
Subject: Code to get Administrators group name from SID

Hi,

I wrote some code to get the administrators group name for the registry
by looking up the name for the SID. We could use it for
$ENV('ADMINGROUP') = get_admin_group() to modify the net localgroup add
part in the install.pl.
It's tested and works...

--- code ---

# Return the localized name of the Administrators group my mapping the
SID to a name

sub get_admin_group () {
        my $binsid;
        my $acct;
        my $domain;
        my $type;

        # Using S-1-5-32-544 from the wellknown SID page
        #
http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q243330
        # Needs to be converted to a binary SID
        $binsid = pack("CCnnnVV",1,2,0,0,5,32,544);

        #Get Groupname from SID
        if (Win32::LookupAccountSID('',$binsid, $acct, $domain, $type))
{
        #all done
        }
        else {
           die "Unable to get Administrators group name.";
        }

        return $acct;
}
       



-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
_______________________________________________
unattended-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/unattended-devel



Reply via email to