Exchange management requires you to pass $null as a parameter to remove forwarding from a mailbox:
Set-Mailbox -ForwardingAddress $null -DeliverToMailboxAndForward $false
This (IMHO) translates to:
command = new PSCommand().AddCommand("Set-Mailbox");
command.AddParameter("Identity",task.TargetUser);
command.AddParameter("FowardingAddress", null);
command.AddParameter("DeliverToMailboxAndForward", false);
ps.Commands=command;
var results = ps.Invoke();
Unfortunately, the Invoke chokes on the "ForwardingAddress" setting: A parameter cannot be found that matches parameter name 'FowardingAddress'.
How can I pass a parameter that ends up as $null?