Jump to content

Launch .exe on remote computer


Recommended Posts

Hi,

I use this code to launch a .exe on a remote computer on lan:

$strComputer = "ComputerName"
    $strProg = "Script.exe"
    
    Dim $objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & $strComputer & "\root\cimv2") 
    Dim $objStartup = $objWMIService.Get("Win32_ProcessStartup") 
    Dim $objConfig = $objStartup.SpawnInstance_(0)
    $objStartup.ShowWindow = 1
    
    Dim $objProcess = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & $strComputer & "\root\cimv2:Win32_process") 
    $intReturn = $objProcess.Create($strProg, $PATHCLIENT, $objStartup, $intProcessID)

But the problem is that with this method which no GUI is shown on the distant screen, the process is hidden although the variable $$objStartup.showwindow is put at 1 (SW_normal). Also if you could help me to regulate this problem, I would be grateful to you.

Bye, + Laught

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...