LogonAsUser

Discussion in 'Perl Misc' started by Jochen Friedmann, Aug 5, 2003.

  1. Hallo zusammen,

    Ich versuche an einem PC (Winn2000 SP2 , mit Domainanbindung) einen Task als
    anderer User zu starten.

    Ich habe die Funktion Win32::AdminMisc::LogonAsUser
    und...::CreateProcessAsUser verwendet. Leider funktioniert das kein
    bisschen.

    Hat vielleicht irgendwer Erfahrung mit diesem Modul ?

    CODE:

    {
    print "\nDomain : ";
    my $domain = <STDIN>;
    chop $domain;
    print "\nBenutzername : ";
    my $user = <STDIN>;
    chop $user;
    print "\nPasswort : ";
    my $passwort =<STDIN>;
    chop $passwort;
    print "\nTask : ";
    my $task = <STDIN>;
    chop $task;

    if
    (Win32::AdminMisc::LogonAsUser("$domain","$user","$passwort",LOGON32_LOGON_I
    NTERACTIVE))
    {
    print "Successfully impersonating " . Win32::AdminMisc::GetLogonName() .
    "\n";
    }

    else {print "\nfault";}

    Win32::AdminMisc::CreateProcessAsUser($task,
    "Flags", CREATE_NEW_CONSOLE,
    "XSize", 640,
    "YSize", 400,
    "X", 200,
    "Y", 175,
    "XBuffer", 80,
    "YBuffer", 175,
    "Title", "Title: $user" . "'s $task
    program",
    "Fill", BACKGROUND_BLUE |
    FOREGROUND_RED |
    FOREGROUND_BLUE |
    FOREGROUND_INTENSITY |
    FOREGROUND_GREEN,
    );
    }
    Jochen Friedmann, Aug 5, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page