Hi Mel,
Thank you posting!
>Am I trying to do the impossible?
There is no problem to use the Win32_Process to create a remote process.
But first the Win32_Process should be the instance in the target remote
machine. Then the corresponding WMI connection's authentication mode should
not be the 'Connect', if not, you would get an access denied error.
I tested the following sample code on my side, it works well. I don't use
the Win32_ProcessStartup class in my sample, it seems unnecessary for
creating a simple non-interactive batch process:
string filename = "test.bat";
//the test.bat file is in the target machine's \windows\system32 directory
string strComputer = "ms-testmachine";
//inParams["CurrentDirectory"] = appPath;
ManagementScope oWMIManagementScope;
ConnectionOptions oWMIConnect = new ConnectionOptions();
oWMIConnect.Impersonation = ImpersonationLevel.Impersonate;
string connPath = string.Concat(@"\\", strComputer, @"\root\cimv2");
oWMIManagementScope = new ManagementScope(connPath, oWMIConnect);
ObjectGetOptions o = new ObjectGetOptions(null, System.TimeSpan.MaxValue,
true);
ManagementPath p = new ManagementPath("Win32_Process");
ManagementClass processBatch = new ManagementClass(oWMIManagementScope, p,
o);
ManagementBaseObject inParams = processBatch.GetMethodParameters("Create");
inParams["CommandLine"] = filename;
//Execute the method
ManagementBaseObject outParams = null;
outParams = processBatch.InvokeMethod("Create", inParams, null);
I hope the above sample code helps, if you have any questions or concerns,
please do not hesitate to let me know. I am standing by to help you.
Thanks!
Best regards,
Gary Chang
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
itsomel - 12 Jul 2006 17:26 GMT
Thanks for the help, Gary.
I made your suggested changes and it has eliminated the error. However, it
looks like I have a little more tweaking to do because the batch does not
seem to be firing on the remote machine. It may take me some time to get
back to this, though, since my customer just informed me that the batch file
is no longer needed. (At least I got the opportunity to learn more about
WMI...)
Thanks again,

Signature
Mel
> Hi Mel,
>
[quoted text clipped - 51 lines]
> ==================================================
> This posting is provided "AS IS" with no warranties, and confers no rights.
"Gary Chang[MSFT]" - 13 Jul 2006 03:16 GMT
You are welcome Mel!
Thanks for your quick response.
If you still have interest on this issue, I suggest you can debug into the
program and check the variables of 'filename' and
'/inParams["CurrentDirectory"]' before invoke the Win32_Process.Create
method. My sample batch file is in the target machine's \windows\system32\
directory, and just contained a single command line to copy one file for
test.
Good Luck!
Best regards,
Gary Chang
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.