powershell commands Flashcards

1
Q

how do you finsd the processes running on a port in powershell

A

Get-NetTCPConnection -LocalPort 3000 | Select-Object -ExpandProperty OwningProcess

Explanation:
Get-NetTCPConnection -LocalPort 3000:
Retrieves network connections using port 3000.

Select-Object -ExpandProperty OwningProcess:
Extracts the process ID (PID) of the process using the port.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

how do you stop a process on a specific port

A

Stop-Process -Id 24476 -Force -ErrorAction SilentlyContinue

change the number after id with the pid of the process

How well did you know this?
1
Not at all
2
3
4
5
Perfectly