1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# Dirección IP o nombre de host del sitio al que se realizará el ping $destino = "google.com" # Tamaño del paquete en bytes (100 KB) $tamanoPaquete = 100 * 1024 # Definir el número de pings simultáneos $numeroDePings = 10 # Crear un bloque de script para realizar el ping $scriptBloque = { param($destino, $tamanoPaquete) Test-Connection -ComputerName $destino -Count 4 -BufferSize $tamanoPaquete } # Crear y lanzar 10 hilos para realizar pings simultáneos $hilos = @() 1..$numeroDePings | ForEach-Object { $hilo = [System.Threading.Thread]::new($scriptBloque) $hilo.Start($destino, $tamanoPaquete) $hilos += $hilo } # Esperar a que todos los hilos terminen $hilos | ForEach-Object { $_.Join() } |