title: Testing to see if a scheduled task exist in powershell
body: <p>I can't figure out why the below code won't work:</p>
  
  <pre><code>Function createFirefoxTask() {
     $schedule = new-object -com Schedule.Service 
     $schedule.connect() 
     $tasks = $schedule.getfolder("\").gettasks(0)
  
     foreach ($task in ($tasks | select Name)) {
        echo "TASK: $task.name"
        if($task.equals("FirefoxMaint")) {
           write-output "$task already exists"
           break
        }
     }
  } 
  createFirefoxTask
  </code></pre>
  
  <p>The output I get is this:</p>
  
  <pre><code>FirefoxMaint                                                                          
  
  TASK: @{Name=FirefoxMaint}.name
  TASK: @{Name=Task1}.name
  TASK: @{Name=Task2}.name
  TASK: @{Name=Task3}.name
  TASK: @{Name=Task4}.name
  TASK: @{Name=Task5}.name
  </code></pre>
  
  <p>If I echo <code>$task.name</code> from the shell without going through the script, it properly displays the name.  </p>