1 min read

This week we are going to launch a blog series geared towards folks that are new to PowerShell. The growing popularity of automation is seeing people getting started with the PowerShell scripting language.

The

Start-Transcript is a built-in command that allows you to quickly build a log of actions being taken by your script. There are other ways to build logs, but for beginners using the commands that are available to you is pretty easy.

Getting Started

Using the command is easy to get started and incorporate into your process. The example below will show you how to use the command and see the output that is captured.

Start-Transcript -Path "C:LoggingDemo_Logging.log"
Get-Process
Stop-Transcript

 

Here you can see in the log that was created, it captures run time information and then starts tracking commands that are executed.

With this simple example, you can see how beneficial this option can be for tracking and troubleshooting execution issues.

Additional Features

There are a few parameters that come along with this command that allow you to make your logging more scalable.

  • NoClobber = This parameter allows the command to not overwrite the log file if you are using the same name
  • Append = This parameter will add anything new to the log file that is executed each time your script runs
References

Start-Transcript on Microsoft Docs

 

 

The post [PowerShell Newbie] Using Start-Transcript appeared first on GarryBargsley.com.

The post [PowerShell Newbie] Using Start-Transcript appeared first on SQLServerCentral.