How to save your Exchange 2007 PowerShell session transcript

I was doing some troubleshooting when I came over an article for automating the process for saving your transcript in PowerShell to a file. The article can be found here :

In the article the author talks about editing the PowerShell Profile. I cant do this for every customer site I am at, so I have edited the syntax to fit my needs. If this is run after you launch PowerShell the file is saved at the root of your C drive.

CD \
$date = get-date -UFormat %y%m%d
Start-Transcript c:\$date.txt -append -noclobber

This will set the working directory to the root of the C drive (gives you more real estate to work with), defines a variable called $date, and specifies that it will get the date in the format of YearMonthDay (i.e. 090706), then tells Powershell to start the transcript, and it uses the variable we defined earlier to automatically create a new text file based on the current date.  Additionally, since the default behavior of start-transcript is to overwrite the previous file, we are telling it to append to an existing file (if present), and the -noclobber tells it to not overwrite the previous file.

Powershell does have some other options here.  The Start-Transcript command includes a -Path parameter that you can define, but it is not used here.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.