//todo rewrite this using COM API public override bool Execute() { var taskName = Params[PARAM_NAME_TASK_NAME]; var setStatus = Params[PARAM_NAME_STATUS];// {DISABLED, ENABLED} string statusSwitch = null; if (setStatus == "DISABLED") { statusSwitch = "/disable"; } else if (setStatus == "ENABLED") { statusSwitch = "/enable"; } else { return(false); } string args = $"schtasks /change /tn \"{taskName}\" {statusSwitch} /hresult"; var cmd = new ShellCommand(args); return(cmd.TryExecute(out _)); }