我有问题-ErrorAction SilentlyContinue使用cmdlet'Get-ADUser'
这不起作用,错误显示有或没有-ErrorAction?
get-aduser "JSmith" -ErrorVariable Err -ErrorAction SilentlyContinue
if ($Err){write-host "This is an error!!!!"}
Run Code Online (Sandbox Code Playgroud)
这是有效的(在相同的条件下,没有错误显示并默默地继续?
get-childitem z: -ErrorVariable Err -ErrorAction SilentlyContinue
if ($Err){write-host "This is an error!!!!"}
Run Code Online (Sandbox Code Playgroud) powershell ×1