PowerShell Tip #2

When working with PowerShell , whether it’s for Exchange Server, Exchange Online, Windows or whatever, turning on the Transcript function is a worthwhile option especially if the script is going to be scheduled for daily, weekly, or monthly tasks. The transcript will provide you with an idea of how far the script got or if it possibly encountered errors, you may know how far the script progressed before having issues. This is just one way for troubleshooting a troublesome script.

Remember to start the transcript before any other cmdlet in the script and to stop the transcript when completed, preferably at the end of the PowerShell script. If there are debugging steps, which stop the script from running, make sure to stop the transcript process there as well. Otherwise you will need to run Stop-Transcript manually to stop PowerShell from working with that transcript file.

Microsoft Documentation

Start-Transcript https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.host/start-transcript?view=powershell-6
Stop-Transcipthttps://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.host/stop-transcript?view=powershell-6

Related Post

ConsistencyConsistency

Depending on your background or tendencies, coding may not come natural as it does for other people. I have found over time that one aspect in coding will make your