I trying to execute this powershell command from C#
gci C:\Ditectory -Recurse | unblock-file -whatif
using this code
Runspace space = RunspaceFactory.CreateRunspace();
space.Open();
space.SessionStateProxy.Path.SetLocation(directoryPath);
Pipeline pipeline = space.CreatePipeline();
pipeline.Commands.Add("get-childitem");
pipeline.Commands.Add("Unblock-File");
pipeline.Commands.Add("-whatif");
var cresult = pipeline.Invoke();
space.Close();
I keep getting an exception about the whatif not being recognized command. Can I use whatif from C#