Menu
Newbedev LogoNEWBEDEV Python Javascript Linux Cheat sheet
Newbedev LogoNEWBEDEV
  • Python 1
  • Javascript
  • Linux
  • Cheat sheet
  • Contact

How to get all processes under a session of a particular process that is using a port in Windows cmd

That's actually pretty easy in PowerShell:

# Get the process of the listening NetTCPConnection and the session ID of the process
$SessionId = (Get-Process -Id (Get-NetTCPConnection -State Listen -LocalPort 8081).OwningProcess).SessionId
# Get all processes from that session and stop them
Get-Process | Where-Object { $_.SessionId -eq $SessionId } | 
    Stop-Process -Force -Confirm:$false

Tags:

Windows

Powershell

Batch File

Batch

Windows Command Prompt

Related

Is it reasonable to use NFS on a production web server? When does iptable's conntrack module track states of packets? wget to an IPv4 server from IPv6-only VPS Powershell - Unable to set the Company AD attribute Steps to assign static IP address in CentOS Linux via command line? Is it safe to allow inbound 0.0.0.0/0 on EC2 security group? DNS attacks from external IP with port 80, how could that happened? How can we explain CIDR notation with /24 and /32 to a manager? Microsoft Windows Server 2019 standard evaluation won't accept product code for brand new windows server 2019 essentials A network file on windows is different for different users How to send a signal to a Docker container without affecting restart policy? Restart apache with monit

Recent Posts

Pandas how to find column contains a certain value Recommended way to install multiple Python versions on Ubuntu 20.04 Build super fast web scraper with Python x100 than BeautifulSoup How to convert a SQL query result to a Pandas DataFrame in Python How to write a Pandas DataFrame to a .csv file in Python
© 2021 newbedevPrivacy Policy