Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon

[PowerShell Newbie] Using Start-Transcript from Blog Posts - SQLServerCentral

Save for later
  • 2 min read
  • 24 Nov 2020

article-image

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

powershell-newbie-using-start-transcript-from-blog-posts-sqlservercentral-img-0

 

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.

Unlock access to the largest independent learning library in Tech for FREE!
Get unlimited access to 7500+ expert-authored eBooks and video courses covering every tech area you can think of.
Renews at €18.99/month. Cancel anytime
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.