I want to get the ip of some devices. Some of them are unreachable. If PowerShell wants to get the ip of an unreachable device it terminates the whole Script. I thought about catching the exception. But i could not find anything about how to catch "Host is unknown". I don't know much about exceptions i tried this but of course it does not work:
` try {
$IPClient = Test-Connection $name -Count 1
$IPv4 = $IPClient.IPV4Address.IPAddressToString
} catch {
$IPv4 = "Could not find $name"
}`
If PowerShell finds an not reachable device it terminate the whole Script.
How can i catch this so my List of $namecontinues and may fill the Variable with "no device found with $name" or something like that?