Powershell Transcription in Task Sequences

Recently, we were trying to take a look at transcription logs for a Powershell script that was configured to run in a Task Sequence.  Interestingly, when you run a Powershell script in a task sequence with transcription enabled, instead of creating the log where you specify, the logging is actually intercepted and published to the smsts.log.  This is fine, except, we were trying to generate logs that would be used by another team that isn't especially interested in the rest of the data in the smsts.log.  So, here is what we did to get the transcription logging to actually dump into a specified file.

- Create a new package that contains my Powershell script

- Create a program with a command line that looks something like this:

cmd /c Powershell.exe -ExecutionPolicy Unrestricted -NoProfile -File transcribe.ps1

The syntax we used in the Powershell script looks something like this:

# Start logging

Start-Transcript –path c:\transcribe.log

 

# Stuff

Write-Host “We are logging to c:\”

 

# Stop logging

Stop-Transcript

 

And, here is what the output looks like: