I need to kill foo.exe, but only under a certain user account. Is this possible with taskkill? In this case, killing all instances of foo.exe would be problematic.
taskkill /F /T /IM foo.exe /FI "USERNAME eq target_user"
should do it.
/IM specifies the image name, and the
/FI option specifies a filter to use, in this case, a user with the username "target_user".
In any case, you'll need to be an Administrator on the local system to forcefully terminate processes in another users security context