好吧,我不知所措>。>我已经尝试过尝试/捕获和陷阱功能,但它不会捕获这个错误......
# Adjustable Variables
$Computers_Path = ".\Compuers.txt"
$Log_Path = ".\Log.txt"
# Script Specific Variables
# Validate Adjustable Variables
TRAP { Write-Host "Unable to locate list of computer names at $Computers_Path"; Continue; }
$Computers = Get-Content $Computers_Path