Click here to Skip to main content
15,892,161 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I got an ArgumentException
Quote:
Value does not fall within the expected range
in
wmiProcess.InvokeMethod("Create", processToRun);

What is wrong? Thanks.

What I have tried:

C#
var processToRun = new[] { @"C:\Program Files\Lockheed Martin\Prepar3D v4\Prepar3D.exe" };
var connection = new ConnectionOptions();
connection.Username = "";
connection.Password = "";
var wmiScope = new ManagementScope(String.Format("\\\\{0}\\root\\cimv2", @"192.168.10.155"), connection);
var wmiProcess = new ManagementClass(wmiScope, new ManagementPath("Win32_Process"), new ObjectGetOptions());
wmiProcess.InvokeMethod("Create", processToRun);
Posted
Updated 1-Feb-18 21:28pm

1 solution

Hey you can find your answer at the following links:

Create a Remote Process using WMI in C#[^]
Connecting to WMI Remotely with PowerShell (Windows)[^]

Some nice discussions are going around this topic in here:

Cheers,
--AH
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900