Skip to content

Instantly share code, notes, and snippets.

@Hashbrown777
Last active October 13, 2022 11:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Hashbrown777/c46d05a2298e0e3dabe2d3f8ba765d8c to your computer and use it in GitHub Desktop.
Save Hashbrown777/c46d05a2298e0e3dabe2d3f8ba765d8c to your computer and use it in GitHub Desktop.
&{ Param($hostname, $port)
try {
$tmp = [Net.Sockets.TcpClient]::new($hostname, $port)
$tmp.Connected
$tmp.close()
return
}
catch [System.Net.Sockets.SocketException] {
$Error[0].Exception | Out-Host
}
$False
} -hostname 'google.com' -port 443
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment