How can I see which user is running sqlserver process in a windows 7 machine? I need to know this in order to change some permissions. I opened the task manager but the list is almost empty, maybe because I'am on a virtual machine, do I have a command line option? Thanks
Windows – Find user running windows process
processwindows 7
Related Solutions
Is there any thing like a pipe or similar that I can use on Windows OS to run this command in one line?
Both cmd.exe
and PowerShell support pipes from one command to another. In PowerShell something like (this should be on a single line on the command line, or use ` to escapte newlines in a script):
netstat -ano
| select -skip 4
| % {$a = $_ -split ' {3,}'; New-Object 'PSObject' -Property @{Original=$_;Fields=$a}}
| ? {$_.Fields[1] -match '15120$'}
| % {taskkill /F /PID $_.Fields[4] }
Where:
Select -skip 4
skips the first four header lines. (Select
is short forSelect-Object
used to perform SQL SELECT like projects of objects.%
is short forForeach-Object
which performs a script block on each object ($_
) in the pipeline and outputs the results of the script block to the pipeline. Here it is first breaking up the input into an array of fields and then creating a fresh object with two propertiesOriginal
the string fromnetstat
andFields
the array just created.?
is short forWhere-Object
which filters based on the result of a script block. Here matching a regex at the end of the second field (all PowerShell containers a zero based).
(All tested except the last element: I don't want to start killing processes :-)).
In practice I would simplify this, eg. returning just 0 or the PID from the first foreach
(which would be designed to ignore the headers) and filter on value not zero before calling taskkill
. This would be quicker to type but harder to follow without knowing PowerShell.
How can I see which user accounts are running which processes?
Solution 1 - Using the TaskManager
Click on the details
tab to see see processes and users.
Source Windows 8 Task Manager In-depth Review (Updated)
Solution 2 - Using tasklist
Use the /v
(Displays verbose task information) command line option:
tasklist /v
One of the output columns is "User Name".
Example output:
Further Reading
- An A-Z Index of the Windows CMD command line - An excellent reference for all things Windows cmd line related.
- tasklist - TaskList displays all running applications and services with their Process ID (PID) This can be run on either a local or a remote computer.
Best Answer
The
Applications
tab of task manager will only show desktop applications. You should be able to see the SQL Server process in theProcesses
tab. Make sure you click theShow Processes from All Users
button at the bottom of the task manager screen.The other way do do this is to see what user is defined in the service properties:
Services
from the resultsLog On
tab and you will see that SQL Server is either running as system, or a specific account.