www.jonsDocs.org.uk


Add your comment

This blog isn't allowing comments at this time.

Previous Comments


PowerShell cmdlet: start-transcript

On Mon 26th November 2012, 14:38 Jonathansays:

.Ever heard the acronym CMA? It stands for Cover My Arse (not to be confused with the Biblical commandment not to covert your neighbour's ass) and is generally good practice when working on something - especially if that something belongs to someone else! If you've ever b een accused of breaking something simply on the grounds that you were the last person to touch a system then this cmdlet is for you!

PowerShell is powerful (as the name suggests) and you can manage a lot of server applications with it - an accident in an elevated PowerShell prompt would not go well. Start-Transcript will log every command you type, its output (including errors) to a text file so you can either prove you didn't break something or find out how you broke it and how to fix it.

So, when I start working on a server with Powershell the first thing I do is:
start-transcript c:\logs\DescriptiveLogFileName.txt
I then set about sorting out whatever it is I'm doing, creating user mailboxes for example. You may be thinking "if you're only running a cmdlet with the verb get there's no risk" - while that's true it's always best to have a complete log - not only will it help you work out why you were doing what you were doing it'll also save the results to a text file for you saving the additional need for out-file.

The transcript stops when you close the shell but to be tidy, issue:
stop-transcript
to finish..

Tags: