Get-NetIPAddress does not respect $ErrorActionPreference = “Stop”
I have a script that is set with `$ErrorActionPreference = “Stop”` and `Get-NetIPAddress` fails, but the script continues to run for some reason. Passing `-Error Stop` to `Get-NetIPAddress` will fix that, but I would expect to stop without it as well.
I read both about ErrorActionPreference and Get-NetIPAdress and didn’t see any mention of this behavior.
Here is a short repro – link
I was wondering if someone can help me understand why this happens, and whether there are any more magical cmdlets that are behaving the same.
Thanks.
For context, I’m using powershell version 5.1.
I have a script that is set with `$ErrorActionPreference = “Stop”` and `Get-NetIPAddress` fails, but the script continues to run for some reason. Passing `-Error Stop` to `Get-NetIPAddress` will fix that, but I would expect to stop without it as well. I read both about ErrorActionPreference and Get-NetIPAdress and didn’t see any mention of this behavior. Here is a short repro – link I was wondering if someone can help me understand why this happens, and whether there are any more magical cmdlets that are behaving the same. Thanks. For context, I’m using powershell version 5.1. Read More