How to pass a parameter to PowerShell Get-NetTCPConnection cmdlet?

138 Views Asked by At

I need to pass a parameter in a PowerShell script coming from Zabbix, and I'm not getting sucess on that.

Here is my script (which run if a specify the port in XX).

$count_unique_ips = Get-NetTCPConnection -LocalPort XX -State
Established | group RemoteAddress -NoElement  
Write-Output $count_unique_ips.count

I need to pass any port number which coming in the XX field, but when I try pass using $1, but I can't run this command. It runs only when I set the port hardcoded.

0

There are 0 best solutions below