presents by IT Consulting 109

PoweShell – 特定 TCP ポートが開いているか確認

概要

PowerShell で telnet と同様なポートの確認をする場合、Windows 8.1 / Windows Server 2012 R2 以降であれば、Test-NetConnection で確認することができます。

 

手順

PS C:\Users\hoge> Test-NetConnection www.google.co.jp -Port 443

実行結果

ComputerName     : www.google.co.jp
RemoteAddress    : 142.250.196.131
RemotePort       : 443
InterfaceAlias   : イーサネット
SourceAddress    : 192.168.1.100
TcpTestSucceeded : True

 

補足

ポートが利用できない場合 Connection が failed となる。

PS C:\Users\hoge> Test-NetConnection www.google.co.jp -Port 443
警告: TCP connect to (142.25.196.131 : 22) failed

ComputerName           : www.google.co.jp
RemoteAddress          : 142.250.196.131
RemotePort             : 22
InterfaceAlias         : イーサネット
SourceAddress          : 192.168.1.100
PingSucceeded          : True
PingReplyDetails (RTT) : 9 ms
TcpTestSucceeded       : False
この記事を書いた人
名前:TRUE's。 千葉県育ち、神奈川県在住のIT系フリーエンジニア。 IT系のナレッジサイトを不定期で更新中。 フォトグラファー兼エンジニアとして日々勤しんでいる。

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

This website stores cookies on your computer. These cookies are used to provide a more personalized experience and to track your whereabouts around our website in compliance with the European General Data Protection Regulation. If you decide to to opt-out of any future tracking, a cookie will be setup in your browser to remember this choice for one year.

Accept or Deny