Im trying to run an executable file remotely on Windows using the wmi module. it establishes the connection but I think my process line is incorrect, as when I check the server the executable definately has not been run. Can you guys help me on the syntax with this?
import wmi, time
ip = '10.12.62.186'
username = "administrator"
password = "CLARiiON!"
from socket import *
print "Establishing connection to %s" %ip
connection = wmi.WMI(ip, user=username, password=password)
print "Connection established"
print "Starting IO"
connection.Win32_Process.Create(CommandLine='cmd.exe C:\Users\Public\Desktop\Auto_IOX.exe')
time.sleep(60)
Take a look at Tim Golden's tutorial. You are not using the information that the Win32_Process.Create method returns.
As a result you may be missing out on the process ID and on the result of starting that remote process.
I managed to figure it out (With help from DDay) by creating a Batch file that ran everything that i needed and put it on the desktop and then ran that instead.