How to find out all cmdlet that contains -filer parameters

Hello everyone,

I have two question about ps:

  1. How to find out all cmdlet that contains -filer parameters , I tried Get-Command | where SYNTAX -Match “-Filter” ,but not work.

  2. In Linux, if I want to know which daemon listen on which ports , I will use ss -tln as bellow.

[xxx@myserver ~]$ ss -tlp
State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
LISTEN 0 128 0.0.0.0:ms-wbt-server 0.0.0.0:*
LISTEN 0 4096 0.0.0.0:websm 0.0.0.0:*
LISTEN 0 128 0.0.0.0:ircu-2 0.0.0.0:*
LISTEN 0 4096 127.0.0.1:h2250-annex-g 0.0.0.0:*
LISTEN 0 128 0.0.0.0:ssh

This is a very convenient way at work, but how to do that in ps , Get-NetTCPConnection , it lists PID ,but not list process name, how to list both?

Thanks in advance.

BR

Alex

Hello Alex,

# 1
Get-Command | Where { $_.parametersets -like "*Filter*"}

#2
Get-Process -Id (Get-NetTCPConnection -LocalPort <portNumber>).OwningProcess

Reference: https://stackoverflow.com/questions/48198/how-can-you-find-out-which-process-is-listening-on-a-port-on-windows

 

Hope that helps.

Get-Command -ParameterName filter

There’s no syntax property. This seems to work:

get-command | where definition -match '-filter'