http://www.perlmonks.org?node_id=124374


in reply to su on winnt

Use the Win32::AdminMisc module available from www.roth.net.

Here's how to use ppm

PPM> set repository roth http://www.roth.net/perl/packages PPM> install Win32-AdminMisc
As long as the program is runing as the system user, you can use this piece of code to change the user.
Win32::AdminMisc::LogonAsUser($domain,$username,$password);
I hope this helps.