Home > PowerShell > How to Ping a Computer using PowerShell

How to Ping a Computer using PowerShell

Pinging a computer is really simple, and of course since this is PowerShell we don’t want to use something as primitive as ping.exe, we want to use .NET and take advantage of all the method calls and filters.

1
2
$ping = New-Object System.Net.NetworkInformation.Ping
$ping.Send("www.brangle.com")

We can also set a timeout so that our computer doesn’t hang to long on a server that won’t respond. Let’s add a timeout of a 5 seconds, we will first need to convert this to milliseconds, so that’s 5,000ms. Of course 5 seconds may not be a resonable timeout, you need to figure out what’s appropriate for you and what you’re willing to tolerate.

1
2
$ping = New-Object System.Net.NetworkInformation.Ping
$ping.Send("www.brangle.com", 5000)

Technical details: System.Net.NetworkInformation.Ping requires that you have .NET 2.0 or greater.

  1. September 13th, 2009 at 21:29 | #1

    Ping is a computer network tool used to test whether a particular host is reachable across an IP network.It is also used to self test the network interface card of the computer or as a latency test.I commonly do this when checking my internet connection status.

  2. May 10th, 2022 at 18:06 | #2

    It is the best time to make some plans for the future and it is time to be happy.
    I have read this post and if I could I desire to suggest you few interesting things or advice.
    Perhaps you can write next articles referring to this article.
    I want to read more things about it!

  1. November 8th, 2019 at 18:38 | #1
  2. November 25th, 2019 at 18:21 | #2
  3. November 26th, 2019 at 14:18 | #3
  4. November 26th, 2019 at 16:56 | #4
  5. November 26th, 2019 at 17:19 | #5
  6. November 27th, 2019 at 00:48 | #6
  7. November 27th, 2019 at 04:30 | #7
  8. November 27th, 2019 at 05:21 | #8
  9. November 28th, 2019 at 08:03 | #9
  10. April 3rd, 2020 at 00:09 | #10
  11. May 21st, 2020 at 12:47 | #11
  12. June 17th, 2020 at 02:05 | #12
  13. June 24th, 2020 at 14:31 | #13
  14. July 22nd, 2020 at 22:15 | #14
  15. July 22nd, 2020 at 23:58 | #15
  16. September 12th, 2020 at 08:10 | #16
  17. September 6th, 2021 at 20:21 | #17
  18. September 7th, 2021 at 09:51 | #18
  19. September 27th, 2021 at 23:31 | #19
  20. September 28th, 2021 at 05:07 | #20
  21. September 28th, 2021 at 13:51 | #21
  22. September 30th, 2021 at 12:56 | #22
  23. October 12th, 2021 at 07:34 | #23
  24. October 13th, 2021 at 09:24 | #24
  25. October 15th, 2021 at 18:56 | #25
  26. October 16th, 2021 at 20:41 | #26
  27. October 16th, 2021 at 23:45 | #27
  28. October 17th, 2021 at 10:53 | #28
  29. October 18th, 2021 at 05:36 | #29
  30. October 18th, 2021 at 18:04 | #30
  31. October 24th, 2021 at 13:58 | #31
  32. October 26th, 2021 at 17:21 | #32
  33. October 28th, 2021 at 23:21 | #33
  34. November 2nd, 2021 at 01:15 | #34
  35. November 2nd, 2021 at 04:35 | #35
  36. November 4th, 2021 at 13:19 | #36
  37. November 7th, 2021 at 15:34 | #37
  38. November 8th, 2021 at 21:20 | #38
  39. November 9th, 2021 at 12:53 | #39
  40. November 9th, 2021 at 23:47 | #40
  41. November 10th, 2021 at 13:51 | #41
  42. November 11th, 2021 at 03:47 | #42
  43. November 20th, 2021 at 18:42 | #43
  44. November 20th, 2021 at 19:20 | #44
  45. November 22nd, 2021 at 12:35 | #45
  46. November 26th, 2021 at 05:49 | #46
  47. December 11th, 2021 at 02:14 | #47
  48. December 12th, 2021 at 01:05 | #48
  49. December 18th, 2021 at 19:40 | #49
  50. December 18th, 2021 at 23:53 | #50
  51. December 19th, 2021 at 21:27 | #51
  52. December 20th, 2021 at 00:41 | #52
  53. December 20th, 2021 at 14:56 | #53
  54. December 21st, 2021 at 14:36 | #54
  55. December 23rd, 2021 at 23:07 | #55
  56. December 23rd, 2021 at 23:07 | #56
  57. December 24th, 2021 at 06:51 | #57
  58. December 24th, 2021 at 16:52 | #58
  59. December 25th, 2021 at 02:15 | #59
  60. December 28th, 2021 at 10:13 | #60
  61. December 29th, 2021 at 05:22 | #61
  62. December 31st, 2021 at 08:57 | #62
  63. December 31st, 2021 at 10:28 | #63
  64. December 31st, 2021 at 10:56 | #64
  65. December 31st, 2021 at 11:33 | #65
  66. December 31st, 2021 at 18:12 | #66
  67. December 31st, 2021 at 19:39 | #67
  68. January 1st, 2022 at 03:44 | #68
  69. January 1st, 2022 at 13:37 | #69
  70. January 1st, 2022 at 20:48 | #70
  71. January 2nd, 2022 at 17:58 | #71
  72. January 2nd, 2022 at 22:47 | #72
  73. January 3rd, 2022 at 16:26 | #73
  74. January 5th, 2022 at 06:15 | #74
  75. January 5th, 2022 at 07:17 | #75
  76. January 7th, 2022 at 14:45 | #76
  77. January 9th, 2022 at 03:08 | #77
  78. January 9th, 2022 at 14:24 | #78
  79. January 10th, 2022 at 02:02 | #79
  80. January 10th, 2022 at 17:28 | #80
  81. January 10th, 2022 at 22:28 | #81
  82. January 11th, 2022 at 13:15 | #82
  83. January 11th, 2022 at 15:40 | #83
  84. January 12th, 2022 at 18:16 | #84
  85. January 13th, 2022 at 03:56 | #85
  86. January 13th, 2022 at 08:56 | #86
  87. January 13th, 2022 at 13:56 | #87
  88. January 14th, 2022 at 06:17 | #88
  89. January 14th, 2022 at 14:51 | #89
  90. January 16th, 2022 at 14:33 | #90
  91. January 18th, 2022 at 04:09 | #91
  92. January 18th, 2022 at 14:22 | #92
  93. January 18th, 2022 at 14:51 | #93
  94. January 19th, 2022 at 14:23 | #94
  95. January 22nd, 2022 at 09:24 | #95
  96. January 22nd, 2022 at 15:51 | #96
  97. January 23rd, 2022 at 22:37 | #97
  98. January 25th, 2022 at 14:08 | #98
  99. January 26th, 2022 at 18:04 | #99
  100. January 28th, 2022 at 01:56 | #100
  101. January 28th, 2022 at 03:23 | #101
  102. January 28th, 2022 at 07:55 | #102
  103. January 28th, 2022 at 17:42 | #103
  104. January 29th, 2022 at 00:13 | #104
  105. January 29th, 2022 at 07:34 | #105
  106. January 30th, 2022 at 00:55 | #106
  107. January 30th, 2022 at 01:42 | #107
  108. January 30th, 2022 at 01:55 | #108
  109. January 30th, 2022 at 10:16 | #109
  110. January 30th, 2022 at 13:22 | #110
  111. January 30th, 2022 at 20:54 | #111
  112. January 30th, 2022 at 22:16 | #112
  113. January 30th, 2022 at 23:57 | #113
  114. January 31st, 2022 at 16:50 | #114
  115. January 31st, 2022 at 17:58 | #115
  116. January 31st, 2022 at 23:54 | #116
  117. February 1st, 2022 at 02:30 | #117
  118. February 1st, 2022 at 08:43 | #118
  119. February 1st, 2022 at 10:30 | #119
  120. February 1st, 2022 at 16:11 | #120
  121. February 3rd, 2022 at 00:58 | #121
  122. February 5th, 2022 at 02:24 | #122
  123. February 5th, 2022 at 07:57 | #123
  124. February 6th, 2022 at 04:38 | #124
  125. February 8th, 2022 at 15:55 | #125
  126. February 9th, 2022 at 10:28 | #126
  127. February 10th, 2022 at 01:14 | #127
  128. February 11th, 2022 at 04:37 | #128
  129. February 12th, 2022 at 05:00 | #129
  130. February 13th, 2022 at 00:19 | #130
  131. February 13th, 2022 at 18:53 | #131
  132. February 14th, 2022 at 00:47 | #132
  133. February 15th, 2022 at 05:56 | #133
  134. February 15th, 2022 at 09:04 | #134
  135. February 15th, 2022 at 15:50 | #135
  136. February 15th, 2022 at 17:20 | #136
  137. February 15th, 2022 at 20:27 | #137
  138. February 17th, 2022 at 01:59 | #138
  139. February 18th, 2022 at 13:42 | #139
  140. February 18th, 2022 at 16:50 | #140
  141. February 23rd, 2022 at 03:19 | #141
  142. February 24th, 2022 at 06:30 | #142
  143. March 2nd, 2022 at 10:38 | #143
  144. March 3rd, 2022 at 13:34 | #144
  145. March 6th, 2022 at 20:17 | #145
  146. March 14th, 2022 at 18:58 | #146
  147. March 14th, 2022 at 21:04 | #147
  148. March 16th, 2022 at 18:41 | #148
  149. March 27th, 2022 at 19:16 | #149
  150. March 30th, 2022 at 19:36 | #150
  151. April 1st, 2022 at 12:38 | #151
  152. April 2nd, 2022 at 10:44 | #152
  153. April 17th, 2022 at 06:26 | #153
  154. April 18th, 2022 at 08:32 | #154
  155. May 10th, 2022 at 05:13 | #155
  156. May 14th, 2022 at 05:01 | #156
  157. May 16th, 2022 at 22:09 | #157
  158. May 18th, 2022 at 02:33 | #158
  159. May 19th, 2022 at 10:16 | #159
  160. May 21st, 2022 at 01:30 | #160