Categories: DatabasesNews

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

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.

Share
Published by

Recent Posts

Top life hacks for prepping for your IT certification exam

I remember deciding to pursue my first IT certification, the CompTIA A+. I had signed…

3 years ago

Learn Transformers for Natural Language Processing with Denis Rothman

Key takeaways The transformer architecture has proved to be revolutionary in outperforming the classical RNN…

3 years ago

Learning Essential Linux Commands for Navigating the Shell Effectively

Once we learn how to deploy an Ubuntu server, how to manage users, and how…

3 years ago

Clean Coding in Python with Mariano Anaya

Key-takeaways:   Clean code isn’t just a nice thing to have or a luxury in software projects; it's a necessity. If we…

3 years ago

Exploring Forms in Angular – types, benefits and differences   

While developing a web application, or setting dynamic pages and meta tags we need to deal with…

3 years ago

Gain Practical Expertise with the Latest Edition of Software Architecture with C# 9 and .NET 5

Software architecture is one of the most discussed topics in the software industry today, and…

3 years ago