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