Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

getting UserSID in Windows

by anadem (Scribe)
on May 25, 2007 at 18:27 UTC ( #617564=perlquestion: print w/ replies, xml ) Need Help??
anadem has asked for the wisdom of the Perl Monks concerning the following question:

I humbly request enlightenment on the issue of obtaining the current UserSID in perl on Windows. Searches in the googolsphere have been entertaining but ultimately fruitless -- can any kind monks give me help?

(The need is to access the registry from a process running under msiexec --an install-- when the "current user" is not the logged-in user because the process is running with system privilege. By reading from HKU\UserSID I can reach the right data.

The Windows API function LookupAccountName returns a SID structure, but somehow I can't find the CPAN digest which reportedly implements that.)

Comment on getting UserSID in Windows
Re: getting UserSID in Windows
by Albannach (Prior) on May 25, 2007 at 19:25 UTC
    Whenever I have a problem with Win32 permissions and Perl I think of Dave Roth's Win32::Perms and sure enough there is even an article with an example that should help you out.

    --
    I'd like to be able to assign to an luser

      Thank you for an excellent reference!
Re: getting UserSID in Windows
by girarde (Friar) on May 29, 2007 at 16:07 UTC
    Something like
    use Win32::OLE; use Win32::OLE::Const ('Active DS'); my $user = Win32::OLE->GetObject("LDAP://$distinguishedName"); my $SID = $user->{objectSID};
    or words to that effect should do it.
Re: getting UserSID in Windows
by ikegami (Pope) on May 29, 2007 at 20:07 UTC

    The Windows API function LookupAccountName returns a SID structure, but somehow I can't find the CPAN digest which reportedly implements that.)

    Arbitrary Windows API functions can be called using Win32::API.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://617564]
Approved by ysth
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (10)
As of 2015-07-07 12:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (88 votes), past polls