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
  161. June 1st, 2022 at 06:45 | #161
  162. June 1st, 2022 at 06:50 | #162
  163. June 5th, 2022 at 06:47 | #163
  164. June 5th, 2022 at 18:58 | #164
  165. June 8th, 2022 at 00:10 | #165
  166. June 12th, 2022 at 22:08 | #166
  167. June 12th, 2022 at 23:23 | #167
  168. June 12th, 2022 at 23:32 | #168
  169. June 13th, 2022 at 00:40 | #169
  170. June 14th, 2022 at 20:05 | #170
  171. June 18th, 2022 at 02:33 | #171
  172. June 22nd, 2022 at 04:14 | #172
  173. June 22nd, 2022 at 04:48 | #173
  174. June 22nd, 2022 at 22:19 | #174
  175. June 22nd, 2022 at 22:49 | #175
  176. June 22nd, 2022 at 23:43 | #176
  177. June 27th, 2022 at 17:36 | #177
  178. July 3rd, 2022 at 23:24 | #178
  179. July 6th, 2022 at 22:13 | #179
  180. July 23rd, 2022 at 18:08 | #180
  181. August 4th, 2022 at 10:08 | #181
  182. August 7th, 2022 at 10:02 | #182
  183. August 9th, 2022 at 15:21 | #183
  184. August 13th, 2022 at 23:12 | #184
  185. August 19th, 2022 at 20:54 | #185
  186. August 20th, 2022 at 20:04 | #186
  187. August 24th, 2022 at 09:22 | #187
  188. August 25th, 2022 at 16:35 | #188
  189. August 25th, 2022 at 22:36 | #189
  190. August 27th, 2022 at 11:55 | #190
  191. August 30th, 2022 at 18:46 | #191
  192. September 12th, 2022 at 14:55 | #192
  193. September 12th, 2022 at 15:05 | #193
  194. September 13th, 2022 at 06:08 | #194
  195. September 16th, 2022 at 11:02 | #195
  196. September 19th, 2022 at 03:26 | #196
  197. September 20th, 2022 at 19:19 | #197
  198. September 21st, 2022 at 05:53 | #198
  199. September 23rd, 2022 at 15:34 | #199
  200. October 5th, 2022 at 05:40 | #200
  201. October 5th, 2022 at 12:18 | #201
  202. October 7th, 2022 at 12:59 | #202
  203. October 10th, 2022 at 09:30 | #203
  204. October 17th, 2022 at 19:46 | #204
  205. October 28th, 2022 at 14:43 | #205
  206. November 3rd, 2022 at 17:54 | #206
  207. November 4th, 2022 at 19:20 | #207
  208. November 7th, 2022 at 07:26 | #208
  209. November 11th, 2022 at 20:28 | #209
  210. November 19th, 2022 at 03:24 | #210
  211. November 19th, 2022 at 08:04 | #211
  212. November 27th, 2022 at 12:58 | #212
  213. November 29th, 2022 at 10:53 | #213
  214. December 5th, 2022 at 10:37 | #214
  215. December 8th, 2022 at 03:59 | #215
  216. December 8th, 2022 at 13:30 | #216