Uninstall Scheduled Task

You are not logging anything by piping it.

At a minimum, you should break it up:

$MyTask = Get-ScheduledTask -TaskName "*MyTask*" 
If ($null -ne $MyTask ) {
   $MyTask | Unregister-ScheduledTask -Confirm:$false
} Else {
   write-log "[*MyTask*] was not found."
}

If you want to try to log more, you can look here:
Logging for non-PSADT commands - The Toolkit / Tips & Tricks - PSAppDeployToolkit Community