Note that there are some explanatory texts on larger screens.

plurals
  1. PORunning commands on remote machine
    text
    copied!<p>I have written a wmi application which runs a batch file on a remote machine.</p> <p>This batch file writes the output to the directory-string passed to it as an argument.</p> <p>When I launch my application, and choose drive C as the output directory, everything works. But, when I choose a network drive, it doesn't work, for some reason.</p> <p>(This network drive is the company's users drive, and mapped for each user on the network).</p> <p>If I run the same exact command (with the network drive) manually from within the remote machine, it also works...</p> <pre><code>ConnectionOptions connOptions = new ConnectionOptions(); connOptions.Impersonation = ImpersonationLevel.Impersonate; connOptions.Username = sUsername; connOptions.Password = sPassword; connOptions.Authority = "NTLMDomain:" + sDomain; connOptions.EnablePrivileges = true; ManagementScope manScope = new ManagementScope(String.Format(@"\\{0}\ROOT\CIMV2", sHost), connOptions); manScope.Connect(); ManagementPath managementPath = new ManagementPath("Win32_Process"); ManagementClass processClass = new ManagementClass(manScope, managementPath, objectGetOptions); ManagementBaseObject inParams = processClass.GetMethodParameters("Create"); for (int i = 0; i &lt; listOfJobs.Items.Count; i++) { listOfJobs.SetSelected(i, true); inParams["CommandLine"] = listOfJobs.SelectedItem.ToString(); ManagementBaseObject outParams = processClass.InvokeMethod("Create", inParams, null); } </code></pre> <p>Example for job strings:</p> <blockquote> <p>Working script: C:\Scripts\BatchScript -p C:\Test C:\OutputDir</p> <p>Failing script: C:\Scripts\BatchScript -p C:\Test U:\OutputDir</p> </blockquote> <p>Any ideas?</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