Book Image

PowerShell Troubleshooting Guide

By : Mike Shepard
Book Image

PowerShell Troubleshooting Guide

By: Mike Shepard

Overview of this book

Table of Contents (15 chapters)
PowerShell Troubleshooting Guide
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

The PSDiagnostics module


PowerShell Version 2.0 is shipped with a new module called PSDiagnostics, which has some interesting capabilities. One drawback to the PSDiagnostics module is that it contains no documentation of any kind except for a single comment at the beginning of the .psm1 file, as shown in the following screenshot:

ETW provides, among other things, the capability to trace system and application activity and write the triggered events to a logfile. The simplest functions in the module are the Enable-PSTrace and Disable-PSTrace functions that turn the Analytic and Debug logs for the Microsoft/Windows/PowerShell log on (or off). Since the functions eventually call the command-line wevutil.exe application that requires input, you will want to use the –Force switch if you are running the ISE since it doesn't handle console input well. Enabling these logs will clear them if they already exist, so make sure that's what you want to do.

There are similar functions that start and stop...