Ok, This is really ugly, but holy mustard stains it "works".
- I have not figured out how to continue after the first error
- In this case, it removes plain files, then stops at the first folder
- I have not figured out how to make this cmdlet work if I add the UseTransaction parameter
This will only work for the Simple case (commands that don't do a lot of stuff with the current environment). I have not tested anything complex
$MyPS = [Powershell]::Create()
Exception calling "Invoke" with "0" argument(s): "A command that prompts the user failed because the host program or the
command type does not support user interaction. The host was attempting to request confirmation with the following
message: The item at D:\Temp\t 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?"
At line:19 char:1
+ CategoryInfo : NotSpecified: (:) , MethodInvocationException
+ FullyQualifiedErrorId : CmdletInvocationException