One thing to keep note is that CreateProcessWithLogonW will fail on XP (and
probably on K3 SP1 but I haven't tested it) if being launched by a process
running as localsystem (like when you run a script from scheduler). MS
changed something in XP SP2 which specifically disallows localsystem from
using the API call. I have been getting quite a few reports of it because of
people using a free tool I have out there called cpau. I haven't had the
chance to break away from work long enough to really dig into it and also I
specifically wrote my tool to be used interactively, if someone is trying to
make a fake service out of it I would rather they wrote a real service.


 joe



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Peter Guzis
Sent: Friday, January 07, 2005 7:27 PM
To: Smith, Gregory; perl-win32-users@listserv.ActiveState.com
Subject: RE: Win32::AdminMisc::CreateProcessAsUser(.....) on Win Server 2003

Which version of Win32::AdminMisc are you using?

The source code for version 20030714 is available at
ftp://ftp.roth.net/pub/ntperl/AdminMisc/20030714/source/.  If Dave hasn't
responded yet, you might try making your changes to the source code and
sending him a patch.  

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of
Smith, Gregory
Sent: Friday, January 07, 2005 12:13 PM
To: perl-win32-users@listserv.ActiveState.com
Subject: RE: Win32::AdminMisc::CreateProcessAsUser(.....) on Win Server
2003


All, 

An update.
 
You won't be able to resolve this with the Win32::AdminMisc module  Roth
consulting will need to resolve this and they don't appear to be interested
in helping as I have sent two separate emails on 2004/11/18 and 2004/11/21
and have yet to even get a response.
 
I am pretty sure they are using two windows API calls in this module
"LogonUser" and "CreateProcessAsUser".  I worked with Microsoft technical
support to get this figured out and for Windows 2003 & XP we now need to use
only one "CreateProcessWithLogonW".  During my debugging with Microsoft I
wrote a C program that did the original two functions to prove the problem
(which was successful) and then after there solution I re-worked my test C
program to use the new function which was the easy part.  
 
I then attempted to use the Win32::API module to call the new function but
after a few days I gave up as part of the problem is
"CreateProcessWithLogonW" requires parameters to be wide character format
(Unicode) "WCHAR" and I

So, after many failed attempts I decided to convert what I had written in
PERL to C.

If someone out here has gotten this to work I'm all ears!

Regards
Greg



-----Original Message-----
From: Smith, Gregory
Sent: Monday, November 15, 2004 4:54 PM
To: 'perl-win32-users@listserv.ActiveState.com'
Subject: Win32::AdminMisc::CreateProcessAsUser(.....) on Win Server 2003


I'm testing out a new server running Windows Server 2003 / SE  that's going
to replace our old Windows 2000 server.

Testing my existing Perl script included below.  The script will run however
the application started looks like a ghost on the console desktop as only
the frame appears.  Hopefully someone has some insight as to what's causing
this and a solution as I am currently at a loss..


Here's my working script:

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_LOGON_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",(localtime)[2]).
 
":".sprintf("%02d",(localtime)[1]).":".sprintf("%02d",(localtime)[0])."  ";

    print log_out $str, $_[0], "\n";

    close(log_out);
    
}


 
Thanks in Advance!

Gregory P. Smith
Pioneer, A DuPont Company
E-Mail: No SPAM:[EMAIL PROTECTED] 
Phone: 515-253-2468




This communication is for use by the intended recipient and contains 
information that may be privileged, confidential or copyrighted under
applicable law.  If you are not the intended recipient, you are hereby
formally notified that any use, copying or distribution of this e-mail,
in whole or in part, is strictly prohibited.  Please notify the sender
by return e-mail and delete this e-mail from your system.  Unless
explicitly and conspicuously designated as "E-Contract Intended",
this e-mail does not constitute a contract offer, a contract amendment,
or an acceptance of a contract offer.  This e-mail does not constitute
a consent to the use of sender's contact information for direct marketing
purposes or for transfers of data to third parties.

 Francais Deutsch Italiano  Espanol  Portugues  Japanese  Chinese  Korean

            http://www.DuPont.com/corp/email_disclaimer.html



_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to