@RedTeamAPT
$ipAddress="192.168.141.145"; $port=445; (New-Object System.Net.Sockets.TcpClient).ConnectAsync($ipAddress, $port).Wait(100) ? "Port $port is OPEN" : "Port $port is CLOSED or unreachable"
#PowerShell
$ipAddress="192.168.141.145"; $port=445; (New-Object System.Net.Sockets.TcpClient).ConnectAsync($ipAddress, $port).Wait(100) ? "Port $port is OPEN" : "Port $port is CLOSED or unreachable"
#PowerShell