briannz556 has asked for the wisdom of the Perl Monks concerning the following question:

Hello kind souls I'm using perl 5.10 and need to be able to impersonate a user part way through a login script I'm writing. I was planning to use adminmisc by Dave Roth but cannot find a version beyond adminmisc-5.8. Can someone direct me to either a version that will work under 5.10 or an alternative option please?

Replies are listed 'Best First'.
Re: impersonation under win32
by BrowserUk (Patriarch) on Mar 25, 2008 at 11:56 UTC

    You can build Win32-AdminMisc sources yourself using AS1000. You'll need

    1. CUString.hpp & CUString.lib

      I ripped these from Win32-Scheduler_v20000702.tar.gz

    2. A one-line edit to include\win32Perl.h

      Line 87 becomes

      #if PERL_VERSION >= 8

      Not in keeping with the style of the header file--but it works!

    3. The following command line (which I wrapped for posting) and which assumes MS VC v6. (Other compilers YMMV):
      cl -MT -LD -EHsc -I"c:\cl\include" -I"include" -I"c:\perl510\lib\CORE" -DWIN32 -DPERL5008 *.cpp *.c CUString.lib WinCPUIDlib.lib lib\Accounts_Lite.lib c:\perl510\lib\CORE\perl510.lib c:\cl\lib\user32.lib c:\cl\lib\AdvAPI32.lib c:\cl\lib\wsock32.lib c:\cl\lib\NetAPI32.lib c:\cl\lib\WinMM.lib c:\cl\lib\Version.Lib ADMINMISC.DEF /link /nodefaultlib:libc

      Adjust paths to suit your setup. Good luck if you want try and generate a makefile :)

      Copy the files:

      • AdminMisc.pm to \your510path\site\lib\Win32\
      • AdminMisc.dll to \your510path\site\lib\auto\Win32\AdminMisc\

    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
      Many thanks for your detailed effort to help me with adminmisc. I'll have to do much research on this as I've never built such before and I'm not too sure what AS1000 is anyway. I know I don't have it :-) Can you tell me what AS1000 is please?
        Can you tell me what AS1000 is please?

        AS1000 is the 5.10 build of perl from Active State.

        (download They've bumped their build number to AS1002 since I got my copy).

        If you're not set up to build your own packages (have an appropriate compiler and know how to use it), then you're better off trying to locate a pre-built binary PPM for the package.


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.
Re: impersonation under win32
by ysth (Canon) on Mar 25, 2008 at 09:35 UTC
    I can't answer your question, but I'd like to expand it. Why would someone write something like Win32::AdminMisc but not put it on CPAN? It's dual Artistic/GPL licensed, so it's not some licensing fear.
      Its not made for cpan
      ADMINMISC_SOURCE | Accounts.h | Accounts_Lite.h | adminbuild.h | adminmisc.cpp | ADMINMISC.DEF | AdminMisc.dsp Microsoft Developer Studio Project File | ADMINMISC.H | ADMINMISC.PM | AdminMisc.RC | CDNS.cpp | CDNS.hpp | CFunMap.cpp | CFunMap.hpp | constant.cpp | constant.h | CPUID.C | Cpuid.h | DNS.CPP | DNS.H | README | README.POD | resource.h | Speed.c | Speed.h | VERSION.H | Win32-AdminMisc.ppd | WinCPUID.c | WinCPUID.h | WinCPUIDlib.lib | +---include | preWin32Perl.h | Win32Perl.h | +---lib | Accounts_Lite.lib | \---test | desktop.pl | MemGroup.pl | NewDesktop.pl | RenameUser.pl | ResetDesktop.pl | SCHED.PL | SCHED2.PL | SWITCH.PL | Test.pl | \---t CreateAsUser.pl GetDriveSpace.pl