Powershell 脚本错误日志

try{
Get-AD *>&1
}
catch{
Get-Date | Add-Content C:\ScriptErrors.txt
$_ | Add-Content C:\ScriptErrors.txt
"----------------------------------------------------------------------------------------
" | Add-Content C:\ScriptErrors.txt
}

posted @ 2020-08-07 13:24  JPinsz  阅读(296)  评论(0编辑  收藏  举报