Running a powershell command in C# errors with, "Cannot invoke this function because the current host does not implement it"
If that command would normally prompt for confirmation then you will need to either:
- Set
-Confirm:$false
as a parameter (and possibly-Force
as well) - Set
$ConfirmPreference = "None"
before calling Set-Mailbox (and possibly-Force
too) - Create a Host and implement the Confirm functionality ;-)