title: PowerShell Update Existing Scheduled Task Trigger Start Date and Time
body: <p>I am attempting to write a script that will update the trigger time for an existing task.  For example change the start time from 12am to 3am.  It will also need the ability to disable/enable the task which i'm currently able to do.  This is what I currently have.</p>
  
  <pre class="lang-cs prettyprint-override"><code>$servers = gc .\servers.txt
  
  $servers | ForEach-Object {
      $srv = $_
      $schedule = New-Object -Com ("Schedule.Service")
      $schedule.Connect("$srv")
      $tasks = $schedule.GetFolder("\").GetTasks(0)
      $totaltasks = $tasks | where {($_.Name -match $matching1)} #-or ($_.Name -match $matching2)}
      $totaltasks | ForEach-Object {
          if ($status -eq "Disable") {
              $_.Trigger = $triggertime #Daily At 3am
              #$_.Triggers.StartBoundary = "2011-10-01T04:00:00"
              #$_.Enabled = $false
              Write-Host "Disabled Task "$_.Name" for server $srv" -ForegroundColor Yellow
          }
  
          if ($status -eq "Enable") {
              $_.Enabled = $true
              $_.Triggers.StartBoundary = "2011-10-01T04:00:00 #&lt;--- Does not work
              Write-Host "Enabled Task "$_.Name" for server $srv" -ForegroundColor Green
          }
  </code></pre>