Try
{
    Write-Host -ForegroundColor yellow "`n--- Scheduled Tasks ---`n"

    function RemoveScheduledTask
    {
        $task_name = $args[0]
        $exists = Get-ScheduledTask | Where-Object {$_.TaskName -like "$task_name" }
        if ($exists) {
            Unregister-ScheduledTask -TaskName $task_name -Confirm:$false
        }
    }

    # launch task
    Write-Host "Removing launch task..." -NoNewline
    RemoveScheduledTask "AA Genie Display App - Launch"
    Write-Host "done."

    # restart windows task
    Write-Host "Removing Windows restart task..." -NoNewline
    RemoveScheduledTask "AA Genie - Restart Windows"
    Write-Host "done."

}
Catch
{
    throw $_.Exception.Message
}