use Win32; use Win32::Process; use Win32::AdminMisc; use Win32::API; logit("Script Started...."); $exeFile = "C:\\windows\\notepad.exe"; $domain = 'YourDomain'; $value1 = 'YourId'; $value2 = 'YourPassword'; if(Win32::AdminMisc::LogonAsUser($domain, $value1, $value2, LOGON32_LO +GON_INTERACTIVE )) { $name = Win32::AdminMisc::GetLogonName(); if ( "\L$value1" ne "\L$name") { logit(" The Login Failed\n domain: $domain user: $value1 +Whos logged in: $name", "-d"); } else { logit(" $domain\\\\$value1 Logged in.."); } } else { logit(" The Login Failed For user: $value1", "-d"); } #Create the process object. if(Win32::AdminMisc::CreateProcessAsUser($exeFile)) { logit(" Started: $exeFile"); } else { logit(" Failed to Start $exeFile ", "-d"); } Win32::AdminMisc::LogoffAsUser(); exit; sub logit { open(log_out,">>script.Log") or die "Can't write to log: $! \n"; $str = (1900+(localtime)[5])."/".sprintf("%02d",(1+(localtime)[4]) +)."/". sprintf("%02d",(localtime)[3])." ".sprintf("%02d",(localtim +e)[2]). ":".sprintf("%02d",(localtime)[1]).":".sprintf("%02d",(loca +ltime)[0])." "; print log_out $str, $_[0], "\n"; close(log_out); }
In reply to Re: Win32::API and CreateProcessWithLogonW
by Anonymous Monk
in thread Win32::API and CreateProcessWithLogonW
by slloyd
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |