ErrorActionPreference and ErrorAction SilentlyContinue for Get-PSSessionConfiguration

前端 未结 3 1995
别跟我提以往
别跟我提以往 2020-12-09 09:09

My case:

$ErrorActionPreference = \"Stop\";
\"1 - $ErrorActionPreference;\"
Get-ChildItem NoSuchFile.txt -ErrorAction SilentlyContinue;
\"2 - $ErrorActionPre         


        
3条回答
  •  南笙
    南笙 (楼主)
    2020-12-09 09:38

    It looks like that's an "unhandled exception", meaning the cmdlet itself hasn't been coded to recognize and handle that exception. It blew up without ever getting to run it's internal error handling, so the -ErrorAction setting on the cmdlet never came into play.

提交回复
热议问题