Take the 2-minute tour ×

Creating an installer for possible remote systems so that if they do not have something installed, it will start the autorun.exe on their desktop (sure it would be easy to give them the link and they could click start and run... but this would be 100% better if it was done for them!)

Heres the model I have been using and I should mention that I am testing between both a windows 7 and XP machine, although I don't think its too big of a deal.

import wmi
import win32com.client

def Copy_Program(computer=None, environment="Production"):
    Oracle_install = r'\\server1\Install\Oracle\Oracle9i_Disk1\autorun\autorun.exe'

    wmi = win32com.client.GetObject ("winmgmts:\\\\"+computer+"\\root\\cimv2")
    win32_process = wmi.Get ("Win32_Process")
    in_parameters = win32_process.Methods_ ("Create").InParameters
    in_parameters.Properties_ ('CommandLine').Value = "notepad.exe"
    result = win32_process.ExecMethod_ ("Create", in_parameters)

    c = wmi.WMI (computer)
    startup = c.Win32_ProcessStartup.new (ShowWindow=SW_SHOWMINIMIZED)
    pid, result = c.Win32_Process.Create (
if __name__ == '__main__':
    Copy_Program(computer = "D02659")

Now as Mr Tim Golden had mentioned in the docs... remoting to another machine is pretty simple... you just


and away you go...

and technically it does work, but its not interactive for some reason... I've also tinkered with the SW_SHOWMINIMIZED values, but I can't seem to understand what I'm doing wrong. I have domain admin, so it shouldn't be an issue... especially since I am logged into both systems at the same time... weird.

Anyhow, help is very much appreciated!

share|improve this question
add comment

2 Answers

This is a limitation of the Create method of the Win32_Process WMI class


Windows 2000 Professional with SP2 and earlier, Windows NT, and Windows 98/95

Win32_Process.Create can create an interactive process remotely.

share|improve this answer
Thanks for your response looks like the answer to this question is to use the wmi module to schedule a task for a minute later... –  Randall.Cummins Jan 24 '12 at 5:37
add comment
up vote 0 down vote accepted

PSEXEC looks like its the only viable solution here unfortunately... as much as I hate to invoke a 3rd party tool, this works well.

import subprocess
import getpass

Oracle = r'\\server\z$\deploy\Install\Oracle\Oracle9i_Disk1\Oracle9i_Disk1\autorun\autorun.exe'

def Craft_Startup(COMPUTER, COMMAND):
    PASSWD = getpass.getpass()
    subprocess.Popen("psexec -u "+ UNAME +" -p " + PASSWD + " \\\\"+COMPUTER+" -i " + COMMAND)

if __name__ == '__main__':
    COMPUTER = 'P04213'
    COMMAND = Oracle
    Craft_Startup(COMPUTER, 'cmd.exe /c start ' + COMMAND)

So the necessity here is to put psexec in the system32 folder or... specify the path if you'd like

share|improve this answer
add comment

Your Answer


