title: PowerShell custom provider RemoveItem
body: <p>I'm implementing a custom <a href="http://en.wikipedia.org/wiki/Windows_PowerShell" rel="nofollow noreferrer">PowerShell</a> provider. I'm now working on the remove-item cmdlet implementation.</p>
  
  <p>The RemoveItem method has the following signature:</p>
  
  <pre><code>protected override void RemoveItem(string path, bool recurse)
  </code></pre>
  
  <p>When I type: <code>Remove-Item .\Myobject -recurse</code> the PowerShell infrastructure provides me with the value <code>true</code> in the <code>recurse</code> parameter of the RemoveItem method.</p>
  
  <p>However when I type: Remove-Item .\MyObject' I get a question:</p>
  
  <blockquote>
    <p>The item at MyObject has children and the Recurse parameter was not specified. If you continue,
     all children will be removed with the item. Are you sure you want to continue?
    [Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"):</p>
  </blockquote>
  
  <p>I guess this question is presented to my by the PowerShell infrastructure. This is perfectly fine because the object that I want to remove is a container. If I answer yes to the above question the PowerShell infrastructure does not set the recurse parameter. In fact it is false when my <code>RemoveItem</code> method is called. I would except the parameter to be true because I answered yes to the question.</p>
  
  <p>My questions are:</p>
  
  <ol>
  <li><p>Why does PowerShell not set the bool recurse parameter to the correct value?</p></li>
  <li><p>Do I need to get the value (answer to the question) in some other way? How?</p></li>
  <li><p>If above is not possible is there a way to suppress the question?</p></li>
  </ol>