LoginSignup
0
1

More than 1 year has passed since last update.

Test-Connectionコマンドについて

Posted at

Test-Connectionとは

PowerShellのコマンドレット『Test-Connection』について解説します。
こちらはDOSコマンドの『ping』にあたり、特定のコンピュータにIPネットワーク経由で接続できるか確認することができます。

構文

Test-Connection
    [-TargetName] <string[]>
    [-Ping]
    [-IPv4]
    [-IPv6]
    [-ResolveDestination]
    [-Source <string>]
    [-MaxHops <int>]
    [-Count <int>]
    [-Delay <int>]
    [-BufferSize <int>]
    [-DontFragment]
    [-TimeoutSeconds <int>]
    [-Quiet]
    [<CommonParameters>]

色々とオプションがありますが、引数にアドレスを持たせるだけでシンプルに実行してみると下記のような結果になります。

PS C:\User> Test-Connection www.google.com

Source   Destination     IPV4Address      IPV6Address                              Bytes    Time(ms)
------   -----------     -----------      -----------                              -----    --------
TEST-PC   www.google.com  142.250.207.36                                            32       10
TEST-PC   www.google.com  142.250.207.36                                            32       9
TEST-PC   www.google.com  142.250.207.36                                            32       9
TEST-PC   www.google.com  142.250.207.36                                            32       11

DOSのpingと同じでデフォルトでは4回送信される。
オプション-Countで回数の指定もできる。

PS C:\Users\user> test-connection -Count 10 google.com

Source    Destination     IPV4Address      IPV6Address                              Bytes    Time(ms)
------    -----------     -----------      -----------                              -----    --------
TEST-PC   google.com      142.250.207.46                                            32       1336
TEST-PC   google.com      142.250.207.46                                            32       12
TEST-PC   google.com      142.250.207.46                                            32       9
TEST-PC   google.com      142.250.207.46                                            32       13
TEST-PC   google.com      142.250.207.46                                            32       10
TEST-PC   google.com      142.250.207.46                                            32       10
TEST-PC   google.com      142.250.207.46                                            32       10
TEST-PC   google.com      142.250.207.46                                            32       9
TEST-PC   google.com      142.250.207.46                                            32       10
TEST-PC   google.com      142.250.207.46                                            32       9

参考

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1