KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I can't figure out why the below code won't work: 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 The output I get is this: 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 If I echo $task.name from the shell without going through the script, it properly displays the name.
Tags (comma-separated)
Save Edits
Cancel