Skip to content

Instantly share code, notes, and snippets.

@JohnL4
Last active May 10, 2023 13:21
Show Gist options
  • Save JohnL4/c1727341e5558cb52be8c728a185ef37 to your computer and use it in GitHub Desktop.
Save JohnL4/c1727341e5558cb52be8c728a185ef37 to your computer and use it in GitHub Desktop.
Find the process id (pid) of a Windows service
$ServicePID = (get-wmiobject win32_service | where { $_.name -eq 'service name'}).processID
# https://social.technet.microsoft.com/Forums/en-US/43fa0ba5-f5b6-43b7-a10b-4957bc4a5f19/how-to-search-a-pid-with-service-name-and-then-task-kill-it?forum=winserverpowershell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment