Note that there are some explanatory texts on larger screens.

plurals
  1. POPython 2.7: wmi module: Creating an interactive process on a remote system
    text
    copied!<p>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!)</p> <p>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.</p> <pre><code>import wmi import win32com.client def Copy_Program(computer=None, environment="Production"): Oracle_install = r'\\server1\Install\Oracle\Oracle9i_Disk1\autorun\autorun.exe' """ BELOW PROCESS SHOWS UP IN TASKMANAGER, but I NEED IT TO BE INTERACTIVE. 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) """ SW_SHOWMINIMIZED = 1 c = wmi.WMI (computer) startup = c.Win32_ProcessStartup.new (ShowWindow=SW_SHOWMINIMIZED) pid, result = c.Win32_Process.Create ( CommandLine=Oracle_install, ProcessStartupInformation=startup ) if __name__ == '__main__': Copy_Program(computer = "D02659") </code></pre> <p>Now as Mr Tim Golden had mentioned in the docs... remoting to another machine is pretty simple... you just </p> <pre><code>c = wmi.WMI("REMOTE_COMPUTER") </code></pre> <p>and away you go... </p> <p>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. </p> <p>Anyhow, help is very much appreciated!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload