http://qs321.pair.com?node_id=349153


in reply to Running Win32 binary as arbitrary user -- in Perl

There is a catch-22 here, of course. You need to have 'act as part of the operating system' rights for the current user to be able to call LogonUser ... hence, you need to be an Administrator (or a system service) to impersonate the Administrator :)

All I want to do is start/stop a service while not running as Administrator, so I guess I will need to use RunAs after all -- anybody know the Windows equivalent of Expect.pm ???

  • Comment on Re: Running Win32 binary as arbitrary user -- in Perl

Replies are listed 'Best First'.
Re: Re: Running Win32 binary as arbitrary user -- in Perl
by Mungbeans (Pilgrim) on Apr 29, 2004 at 15:12 UTC
    Would Win32::Service help? There's a suite of service management functions including: StopService.

    You might be able to get that to play nicely with Win32::AdminMisc CreateProcessAsUser.

    If you have much Win32 stuff to play with Dave Roth's book "Win32 Perl Programming: The Standard Extensions, Second Edition" is well worth checking out.

      Yes, it will help the code (thanks!) -- just won't get me around the evil act-as-part-of-OS-permission problem!

      BTW, I didn't know David Lee Roth was into Perl. Awesome!