官术网_书友最值得收藏!

Understanding Logging and Transcripts

The transcript feature in PowerShell helps you to record all your cmdlets and activities at the prompt. This feature is not available for use in the PowerShell application during the writing of this book. This will help you capture all the commands and outputs from the commands that appear in the console in a text file that you specify using the start-transcript cmdlet.

The Start-transcript cmdlet initializes a transcript file, and then creates records of all the subsequent actions in the PowerShell session.

The syntax is shown as follows:

Here are some of the important parameters that you should know about the start-transcript cmdlet. To save the transcript file to a specified path, use the –Path parameter. You cannot use wildcards when you set the path, but you can also use variables. The directories in the path must exist or the command will fail.

The default behavior of the Start-Transcript cmdlet is to overwrite any file that is in the transcript path unless the –noClobber parameter is specified, which prevents Windows PowerShell from overwriting an existing file.

The –Append parameter will add the new transcript to the end of an existing file. For example, take a look at the following:

PS C:\> Start-Transcript -Path C:\transcript\transcript01.txt –NoClobber

When you want to stop recording the transcript, you can either exit the console or type Stop-transcript. The Stop-Transcript cmdlet requires no additional parameters.

The Stop-transcript cmdlet stops recording actions that was started by the start-transcript cmdlet. Use the following syntax:

PS C:\> stop-transcript
主站蜘蛛池模板: 武城县| 铜川市| 铜山县| 随州市| 利川市| 嘉兴市| 苏州市| 成安县| 永宁县| 宣威市| 余庆县| 寿光市| 抚顺县| 剑河县| 崇明县| 吴堡县| 无为县| 阿勒泰市| 瓦房店市| 仲巴县| 弋阳县| 哈密市| 凤阳县| 鹿邑县| 祁连县| 安图县| 汉川市| 南江县| 台北县| 南开区| 清苑县| 郧西县| 邵阳县| 都匀市| 肇庆市| 错那县| 昭苏县| 阿瓦提县| 铁力市| 广饶县| 莒南县|