Hello guys, need help.
I have a simple code in script and this script works correctly when I run locally :
$server = "srv" $portToCheck = '1433' Test-NetConnection -ComputerName $server -Port $portToCheck
$server = "srv" $portToCheck = '1433' New-Object System.Net.Sockets.TCPClient -ArgumentList $server,$portToCheck
But when I try to call this script remotely by icmp I receive an error :
WARNING: TCP connect to srv:1433 failed false Exception calling “.ctor” with “2” argument(s): “An attempt was made to access a socket in a way forbidden by its access permissions 192.168.12.145:1433”
end I have notify in event:
The Windows Filtering Platform has blocked a connection. Application Information: Process ID: 2524 Application Name: \device\harddiskvolume2\windows\syswow64\windowspowershell\v1.0\powershell.exe Network Information: Direction: Outbound Source Address: 192.168.12.183 Source Port: 54636 Destination Address: 192.168.12.145 Destination Port: 1433 Protocol: 6 Filter Information: Filter Run-Time ID: 66927 Layer Name: Connect Layer Run-Time ID: 48
So, I had blocked package. Have you any ideas how to get around the problem? I would like to resolve this issue only with help PowerShell solution without writing filter by C++ for ALE WFP
I tried to use in script body: Invoke-command , -asjob
Now I’ve created job in task scheduler and ICMP call to start job. Result (true or false) write to txt file after that I’ve got content. But it’s crutch and isn’t true way.
Additionally: this situation catch only on servers with Server 2012R2 (WMF4), on Server 2008r2 all works without any problems.