|Well, if you're insistent on batch, you could use something like this. Parsing the output is left as an exercise for the reader, and false positives are possible.|
schtasks /query /fo csv /v | findstr /i "RDS"
If you were inclined to use one of Windows' better scripting languages, you could talk directly to the Task Scheduler, and ask the tasks to be disabled. For instance, here's VBScript.
If Not HasConsoleOut Then _
WScript.Quit CreateObject("WScript.Shell").Run( _
"cmd /k cscript " & WScript.ScriptFullName, 1, True)
Set regex = New RegExp
regex.IgnoreCase = True : regex.Pattern = "\\RDS$"
Set sched = CreateObject("Schedule.Service")
For Each task in oFolder.GetTasks(1)
If (regex.Execute(task.Definition.Principal.UserId).Count) Then
task.Enabled = False
For Each folder in oFolder.GetFolders(1)
On Error Resume Next
HasConsoleOut = Err.Number = 0
How To Ask Questions The Smart Way
message edited by Razor2.3