Reputation: 139
I am trying to disable a task in the Windows task scheduler using PowerShell. How can I do this?
$tasks = & SCHTASKS /Query /V /FO CSV | ConvertFrom-Csv
$task = $tasks | ? { $_.TaskName -eq "E:\MyDir\test.bat" }
& SCHTASKS /Change /DISABLE /TN "$Task.TaskName"
This error is the result:
ERROR: The specified task name ".TaskName" does not exist in the system.
Upvotes: 0
Views: 3769