PS C:\Users\ad_ctjares> Stop-Transcript -ErrorAction silentlycontinue
Transcription has not been started. Use the start-transcript command to start transcription.
Stop-Transcript : An error occurred stopping transcription: The console host is not currently transcribing.
At line:1 char:16
+ Stop-Transcript <<<< -ErrorAction silentlycontinue
+ CategoryInfo : InvalidOperation: (:) [Stop-Transcript], PSInvalidOperationException
+ FullyQualifiedErrorId : InvalidOperation,Microsoft.PowerShell.Commands.StopTranscriptCommand
Mã nói tất cả.Tại sao lỗi vẫn hiển thị khi tôi chỉ định -ErrorAction SilentlyContinue?
Không biết, nhưng có lỗi được lưu trên Kết nối về nó, cùng với giải pháp thay thế: http://connect.microsoft.com/PowerShell/feedback/details/549321/start-stop-transcript-ignores-erroraction – Dogmang
Cảm ơn - điều đó đã dẫn tôi đến đây: http://stackoverflow.com/questions/6307127/hiding-errors-when-using-get-adgroup, nơi tôi phát hiện ra mình cần sử dụng 'try {} catch {}' vì '-ErrorAction' không ảnh hưởng đến lỗi chấm dứt –