Powershell Transcription in Task Sequences
Greetings Community, I've got some powershell scripts executing from a task sequence step (Command: Powershell.exe -File <Path>) and use transcription for the logging. Outside of the task sequence, transcription works great. However, none of my script output is being transcribed when the scripts execute from the task sequence. It is, however, being logged to smsts.log. The blog linked below would seem to indicate there's nothing special about transcription in a task sequence, but nevertheless, I am without a transcription log. I could quite easily use file-cmdlets to force my logging seperately or other methods - but that's not my intent. Pasted below is a short test script I am calling from a one-step task sequence that should write ttwo lines to the transcript, but as you can see in the pasted transcript, no lines were written. Help? :) Thanks! http://blogs.technet.com/b/mniehaus/archive/2009/09/22/running-powershell-scripts-as-part-of-a-task-sequence.aspx ::Script Content:: #Transcription Testing #Create TS Env COM object $TS = New-Object -ComObject "Microsoft.SMS.TSEnvironment" #Define Log Path $LogPath = $TS.Value('_SMSTSLOGPATH') $LogFile = "$($MyInvocation.MyCommand).log" $Log = "$LogPath\$LogFile" #Start Logging Start-Transcript $Log -Force "This line should be transcribed" Write-Host "This line should also be transcribed" Write-Output "Not sure about this one" Stop-Transcript Exit 0 ::Transcript Content:: ********************** Windows PowerShell Transcript Start Start time: 20100806133804 Username : D3TEST\SYSTEM Machine : D3TEST-WIN7 (Microsoft Windows NT 6.1.7600.0) ********************** ********************** Windows PowerShell Transcript End End time: 20100806133804 ********************** ::SMSTSLog Content:: Start executing an instruciton. Instruction name: Transcription Testing. Instruction pointer: 1 TSManager 8/6/2010 2:16:41 PM 2260 (0x08D4) Set a global environment variable _SMSTSCurrentActionName=Transcription Testing TSManager 8/6/2010 2:16:41 PM 2260 (0x08D4) Set a global environment variable _SMSTSNextInstructionPointer=1 TSManager 8/6/2010 2:16:41 PM 2260 (0x08D4) Set a local default variable SMSTSDisableWow64Redirection TSManager 8/6/2010 2:16:41 PM 2260 (0x08D4) Set a local default variable _SMSTSRunCommandLineAsUser TSManager 8/6/2010 2:16:41 PM 2260 (0x08D4) Set a local default variable SMSTSRunCommandLineUserPassword TSManager 8/6/2010 2:16:41 PM 2260 (0x08D4) Set a global environment variable _SMSTSLogPath=C:\Windows\system32\CCM\Logs\SMSTSLog TSManager 8/6/2010 2:16:41 PM 2260 (0x08D4) Expand a string: smsswd.exe /run: Powershell.exe -File "C:\Temp\SAL\Transcription.ps1" TSManager 8/6/2010 2:16:41 PM 2260 (0x08D4) Expand a string: TSManager 8/6/2010 2:16:41 PM 2260 (0x08D4) Start executing the command line: smsswd.exe /run: Powershell.exe -File "C:\Temp\SAL\Transcription.ps1" TSManager 8/6/2010 2:16:41 PM 2260 (0x08D4) !--------------------------------------------------------------------------------------------! TSManager 8/6/2010 2:16:41 PM 2260 (0x08D4) Expand a string: WinPEandFullOS TSManager 8/6/2010 2:16:41 PM 2260 (0x08D4) Executing command line: smsswd.exe /run: Powershell.exe -File "C:\Temp\SAL\Transcription.ps1" TSManager 8/6/2010 2:16:41 PM 2260 (0x08D4) =======================[ smsswd.exe ] ======================= InstallSoftware 8/6/2010 2:16:41 PM 1732 (0x06C4) PackageID = '' InstallSoftware 8/6/2010 2:16:41 PM 1732 (0x06C4) BaseVar = '', ContinueOnError='' InstallSoftware 8/6/2010 2:16:41 PM 1732 (0x06C4) SwdAction = '0001' InstallSoftware 8/6/2010 2:16:41 PM 1732 (0x06C4) Working dir 'not set' InstallSoftware 8/6/2010 2:16:41 PM 1732 (0x06C4) Executing command line: Run command line InstallSoftware 8/6/2010 2:16:41 PM 1732 (0x06C4) Process completed with exit code 0 InstallSoftware 8/6/2010 2:16:42 PM 1732 (0x06C4) Transcript started, output file is C:\Windows\system32\CCM\Logs\SMSTSLog\Transc InstallSoftware 8/6/2010 2:16:42 PM 1732 (0x06C4) ription.ps1.log InstallSoftware 8/6/2010 2:16:42 PM 1732 (0x06C4) This line should be transcribed InstallSoftware 8/6/2010 2:16:42 PM 1732 (0x06C4) This line should also be transcribed InstallSoftware 8/6/2010 2:16:42 PM 1732 (0x06C4) Not sure about this one InstallSoftware 8/6/2010 2:16:42 PM 1732 (0x06C4) Transcript stopped, output file is C:\Windows\system32\CCM\Logs\SMSTSLog\Transc InstallSoftware 8/6/2010 2:16:42 PM 1732 (0x06C4) ription.ps1.log InstallSoftware 8/6/2010 2:16:42 PM 1732 (0x06C4) Command line returned 0 InstallSoftware 8/6/2010 2:16:42 PM 1732 (0x06C4) Process completed with exit code 0 TSManager 8/6/2010 2:16:42 PM 2260 (0x08D4) !--------------------------------------------------------------------------------------------! TSManager 8/6/2010 2:16:42 PM 2260 (0x08D4) Successfully complete the action (Transcription Testing) with the exit win32 code 0 TSManager 8/6/2010 2:16:42 PM 2260 (0x08D4)
August 7th, 2010 12:17am

Hi, I have seen that to, not sure why, trying to figure this out. However, if you make you script an "Application" it works perfectly with transcript. It aslo work if you run the script like this: cmd /c Powershell.exe -ExecutionPolicy Unrestricted -NoProfile -File %SCRIPTROOT%\MyHappyScript.ps1 I have tested this with LiteTouch and it works. So there is a difference, just need to figure out why... /Mike MCP, MCDST, MCT, MVP Windows Server - Setup/Deployment
Free Windows Admin Tool Kit Click here and download it now
January 4th, 2011 4:49pm

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

Other recent topics Other recent topics