in reply to Win32::KillProcess
thanks to @dawn in her node Re: Re: Win32::OLE (Variants by reference) we can now get the PID when we create the process. I had tried this vefore but she jogged my memory... we need to pass a Variant by Reference!
my $Startup_Class = $wmihandle->Get("Win32_ProcessStartup"); my $Startup_Config = $Startup_Class->SpawnInstance_ ; my ($error, $pid, $startup_folder); $startup_folder="C:\\TEMP\\"; $pid= Variant(VT_I4|VT_BYREF, 0); if (0 == $wmiprocesses->Create($command_path,$startup_folder,$Startup_ +Config,$pid) ) { if ($pid) { print "pid=$pid\n"; } #blah blah blah
I've tested this and it works a treat! Thanks @dawn for pointing out obvious thing we missed in the WMI docs.
- Mark
|
---|