add script

This commit is contained in:
2025-08-06 10:35:05 +02:00
parent b78e202f58
commit ef09f0b350
229 changed files with 264140 additions and 1 deletions

19
Réseau/Ping.ps1 Normal file
View 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) }