title: WMI: Create Method of the Win32_Service Class
body: <p>I'm trying to use the Create method of the Win32_Service class, but when I call the InvokeMethod, I receive this exception:</p>
  
  <pre><code>System.Management.ManagementException: Invalid method 
  at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode)
  at System.Management.ManagementObject.InvokeMethod(String methodName, ManagementBaseObject inParameters, InvokeMethodOptions options)
  at &lt;StartupCode$FSI_0075&gt;.$FSI_0075.main@()
  </code></pre>
  
  <p>This is the code (in F# but it is understable for C# programmers too :)):</p>
  
  <pre><code>let scope = new ManagementScope(@"root\cimv2", null)
  use imageService = Utility.getServiceObject scope "Win32_Service"
  use inParams = imageService.GetMethodParameters("Create")
  inParams.["Name"] &lt;- name
  inParams.["DisplayName"] &lt;- displayName
  inParams.["PathName"] &lt;- pathName
  inParams.["ServiceType"] &lt;- 0x10   // Own Process
  inParams.["ErrorControl"] &lt;- 0     // User is not notified
  inParams.["StartMode"] &lt;- "Automatic"
  inParams.["DesktopInteract"] &lt;- false
  inParams.["StartName"] &lt;- "LocalSystem"
  inParams.["StartPassword"] &lt;- ""
  inParams.["ServiceDependencies"] &lt;- null
  
  use outParams = imageService.InvokeMethod("Create", inParams, null) 
  </code></pre>
  
  <p>The exception is thrown when the last line is executed (I removed the next lines).</p>
  
  <p>I think I'm calling correctly the method, so I don't know why the exception is thrown.
  Can anyone help me?</p>
  
  <p>Thanks in advance,
  Marco</p>