How to query the task manager
Powershell:
Get-WmiObject Win32_Process | Select Name, ProcessId, CommandLine
Have a look at PowerShell and the Get-Process
command; it can give you any info you'll find in the Task Manager, and a lot more.
https://technet.microsoft.com/en-us/library/hh849832.aspx
https://technet.microsoft.com/en-us/library/ee176855.aspx