相关疑难解决方法(0)

PowerShell -ErrorAction SilentlyContinue不适用于Get-ADUser

我有问题-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

14
推荐指数
2
解决办法
2万
查看次数

标签 统计

powershell ×1