Making a remote process visible

Discussion in 'Perl' started by Mark Elley, Nov 5, 2003.

  1. Mark Elley

    Mark Elley Guest

    I am using the following code to start a process on a networked XP
    machine. This all works really well but the process created is
    invisible to the user (only visible in the Task Manager - Processes
    tab). I need this process to be visible. I have searched for the
    answers but have come to the conclusion that it is either a)
    impossible or b) it is so easy that it is not documented !!!

    Usage: perl filename.pl exe_to_run.exe

    use Win32::OLE qw( in );
    use Win32::OLE::Variant;

    $Machine = "10.141.9.73";

    $CLASS = "WinMgmts:{impersonationLevel=impersonate}!//$Machine";

    $WMI = Win32::OLE-> GetObject( $CLASS ) || die "Unable to connect to
    $Machine:" . Win32::OLE->lastError();

    $PROCESSSTARTUP = $WMI-> Get("Win32_ProcessStartup")->SpawnInstance_;

    $PROCESSSTARTUP-> {WinstationDesktop} = "winsta0\\default";

    $PROCESSSTARTUP-> {ShowWindow} = 1;

    print "$PROCESSSTARTUP-> {WinstationDesktop}\n";

    $Process = $WMI-> Get( "Win32_Process" ) || die "Unable to get the
    process list:" . Win32::OLE-> LastError();

    $vPid = Variant( VT_I4 | VT_BYREF, 0 );

    if( 0 == $Process-> Create( join( " ", @ARGV ), undef,
    $PROCESSSTARTUP, $vPid ) ) {
    print "Process successfully created with PID $vPid\n";
    }
    else {
    print "Failed to create process.\n";
    }
    Mark Elley, Nov 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.
Similar Threads
  1. spamfurnace
    Replies:
    1
    Views:
    2,624
    Scott M.
    May 24, 2004
  2. tshad

    button visible/not visible

    tshad, Oct 26, 2004, in forum: ASP .Net
    Replies:
    6
    Views:
    4,425
    Brian Hoops
    Oct 28, 2004
  3. tshad

    Sections visible and not visible

    tshad, Jan 31, 2005, in forum: ASP .Net
    Replies:
    4
    Views:
    2,045
    tshad
    Jan 31, 2005
  4. Patrick Olurotimi Ige
    Replies:
    7
    Views:
    5,938
    Patrick Olurotimi Ige
    Jun 15, 2005
  5. tshad
    Replies:
    1
    Views:
    4,217
    tshad
    Oct 31, 2009
Loading...

Share This Page