I apologize. The corrected code would be:
Using ts As New TaskService()
Dim task = ts.RootFolder.Tasks("TEST")
If task IsNot Nothing
ts.RootFolder.RegisterTaskDefinition("TEST", task.TaskDefinition, TaskCreation.CreateOrUpdate, "User", "NewPassword", TaskLogonType.Password)
End If
End Using