Powershell Log File

I've searched for script or functions to create a log file from a script I run each night.  The main script just sets variables and then calls other scripts (18 of them).  The last script sends me an email with various information and at times I've failed to get the email and without having some kind of log file, I'm not sure how to figure out what when wrong.  Is there a simple way to create a log file?  It could be overwritten each night as the only time it would be viewed is if something when wrong.

Thanks,

Kevin

February 25th, 2015 6:09am

I like using the windows event log, it's covered well here:

http://blogs.technet.com/b/heyscriptingguy/archive/2013/06/20/how-to-use-powershell-to-write-to-event-logs.aspx

Free Windows Admin Tool Kit Click here and download it now
February 25th, 2015 6:11am

Try the following

http://blogs.technet.com/b/heyscriptingguy/archive/2013/02/23/weekend-scripter-creating-a-sample-log-file-by-using-powershell.aspx

February 25th, 2015 6:11am

Frequently, just enabling transcription will provide sufficient logging to diagnose problems.

See 

Get-Help Start-Transcript

Free Windows Admin Tool Kit Click here and download it now
February 25th, 2015 6:31am

See this script for logging.
February 25th, 2015 7:13am

WOW - Great feedback, will dig into these and see what works... thanks for all the feedback and quick response!
Free Windows Admin Tool Kit Click here and download it now
February 25th, 2015 9:42am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics