Script: variabler Ping für unterschiedliche Netzwerke

Post Reply
cka
Posts: 153
Joined: Mon, 21 May 2012, 13:22

Script: variabler Ping für unterschiedliche Netzwerke

Post by cka » Fri, 17 Jul 2015, 14:50

Script mit variablen Ping für unterschiedliche Netzwerke:

$output -> Should return value "success" or "failed"
$target -> Should be the target device to ping

Beispiel:
$status = test-connection $target -count 1 -quiet

Beim Anlegen des Scriptes muss eine Input Variable 'AEMTarget' angelegt werden.


--- Start Script ---

$target = $env:AEMTarget
$output = "output=" #AEM component output data

$status = test-connection $target -count 1 -quiet #Connection test to target
If ($status -ne "True") {
$output += "Failure" #Connection test failure
} ELSE {
$output += "Success" #Connection test success
}

If($output.Length -ge 8) { #AEM format for output data per documentation. Verifies data is added to $output during the script
Write-Host "<-Start Result->"
Write-Host $output
Write-Host "<-End Result->"
exit 1
}

--- End Script ---
Regards,

CKa
Technical Support Germany,
Panda Security

Post Reply

Return to “HowTo's von User für User”