update
This commit is contained in:
19
Réseau/Ping.ps1
Normal file
19
Réseau/Ping.ps1
Normal file
@ -0,0 +1,19 @@
|
||||
#Fonctionne avec PowerShell 7
|
||||
|
||||
#Ping d'un plage d'IP de 192.168.1.1 à 192.168.1.254
|
||||
1..254 | ForEach-Object -ThrottleLimit 50 -Parallel {
|
||||
Test-Connection "192.168.1.$_" -Count 1 -TimeoutSeconds 2 -ErrorAction SilentlyContinue -ErrorVariable e
|
||||
if ($e)
|
||||
{
|
||||
[PSCustomObject]@{ Destination = $_; Status = $e.Exception.Message }
|
||||
}
|
||||
} | Group-Object Destination | Select-Object Name, @{n = 'Status'; e = { $_.Group.Status } } | Where-Object Status -eq "Success" | Sort-Object { [system.version[]]($_.Name) }
|
||||
|
||||
#Ping à partir d'une liste d'IP dans un CSV
|
||||
Import-Csv -path Ping.csv -Encoding UTF8 | ForEach-Object -ThrottleLimit 5 -Parallel {
|
||||
Test-Connection $_.IP -Count 1 -TimeoutSeconds 2 -ErrorAction SilentlyContinue -ErrorVariable e
|
||||
if ($e)
|
||||
{
|
||||
[PSCustomObject]@{ Destination = $_; Status = $e.Exception.Message }
|
||||
}
|
||||
} | Group-Object Destination | Select-Object Name, @{n = 'Status'; e = { $_.Group.Status } } | Sort-Object { [system.version[]]($_.Name) }
|
1
Réseau/README.md
Normal file
1
Réseau/README.md
Normal file
@ -0,0 +1 @@
|
||||
# Réseau
|
4
Réseau/Templates/Ping.csv
Normal file
4
Réseau/Templates/Ping.csv
Normal file
@ -0,0 +1,4 @@
|
||||
Name, IP
|
||||
Client 1, 1.1.1.1
|
||||
Client 2, 8.8.8.8
|
||||
Client 3, 8.8.4.4
|
|
Reference in New Issue
Block a user