The code below adds only user tasks with windows to the ListBox.
For Each p As Process In Process.GetProcesses
If p.MainWindowTitle.Length > 0 AndAlso p.SessionId > 0 Then
lstProcesses.Items.Add(p.ProcessName & " | " & p.MainWindowTitle)
End If
Next
Why do you need to do this? Perhaps an insight into that would help us provide you best practices.
You may have to study the Win32 SDK APIs to find APIs that you can use to distinguish between user applications and services and other operating system components.
Also, killing processes without first prompting the user to save in process work is considered "bad form".