Problem:-
As one of dba's
every day manage hundreds of servers including dealing with lots of
connectivity issues between application servers and database servers throw
specific port, or because security team perform segregation between clients,
apps and database servers bypassing only traffic between source IP and
destination IP throw specific port, of course for good reasons including
security best practice too.
Solution:-
Therefore I had typed below script can
determine connectivity issue if that port open and ready to receive connection
between source IP (i.e. My Client) and destination IP(i.e. Database Server)
throw a specific port or not.
Notes:-
First. check below as the minimum the requirement you are using.
- Windows Version 8.1 and above
- Windows Server 2012R2 and above
- Run Powershell in elevated privilege (As Administrator)
- Set the Execution policy to bypass by typing (Set-ExecutionPolicy -ExecutionPolicy Bypass )
**Script maybe Take a long time if a lot of IP with multiple Ports but in the
end, you will get the result 😃
How To Use Below Script:-
·
Save to desktop all target IP's (Destination) in a Text file.
i.e.C:\Users\Mk.elsawy\Desktop\Servers.txt
Save below script as TestSQLServerListeningPorts.ps1
- Start Powershell as Administrator.
- Go to TestSQLServerListeningPorts.ps1 saved path
C:\Users\Mk.elsawy\Desktop\TestSQLServerListeningPorts.ps1 and press enter
Now Script will ask you about Servers path in that case type path
i.e.
C:\Users\Mk.elsawy\Desktop\Servers.txt
Now Script will ask you again about port in that case type what you target i.e. 1433
Now we are good, and the result will be showing
if that port enable between this machine and database server or not by
mentioning true or false under status as below
Demo: -
Script if you need to
target one port:-
Script if want to target
multiple ports at once:-
Ref:-
https://support.microsoft.com/en-us/help/4009936/solving-connectivity-errors-to-sql-server
No comments:
Post a Comment