I would have expected that the Transcript would be implemented outside the Host and call both an Add-Content and a Write-Host. I wonder what could have been intended for the Host to use the output from that couldn't be done by a handler in the Write-Host.
So when calling in production scheduler of powershell.exe the transcripts are fine. When I run in the ISE, it doesn't work so well. Of course all of the output is visible on the OutputPane, but the red exception text and lack of per run detail left me unfulfilled.
...Now is there a way to clobber the default stop-transcript then call the original.
try {
Start-Transcript -Path "C:\Transcript.txt" -Append
} catch {
clear # only want this run to output.
}
#profile function
# Todo: Check Verb
# Todo: Check Verb
Function
Export-ISEOutputToWindow
{
$transcriptHeader = @"
**************************************
Windows PowerShell ISE Transcript Start
Start Time: $(get-date)
UserName: $env:username
UserDomain: $env:USERDNSDOMAIN
ComputerName: $env:COMPUTERNAME
Windows version: $((Get-WmiObject win32_operatingsystem).version)
**************************************
Transcript started. Output file is $logname
"@
# Could Pass Transcript File name to Add function and modify the process to Append.... I should do that.
# Could Pass Transcript File name to Add function and modify the process to Append.... I should do that.
$Outfile = $psise.CurrentPowerShellTab.Files.Add();
$Outfile.Editor.Text = $transcriptHeader + $psise.CurrentPowerShellTab.OutPut.Text;
}
#For use
try {
stop-transcript ;
} catch {
Export-ISEOutputToWindow;
}
...Now is there a way to clobber the default stop-transcript then call the original.
Will suggested that I look at http://blogs.technet.com/b/heyscriptingguy/archive/2010/09/25/create-a-transcript-of-commands-from-the-windows-powershell-ise.aspx. This had a ISETranscript that pulled the detail from the output pane. I combined this with a function I saw yesterday on poshcode that implemented an Out-ISEFileTab process. Combined they make the above.
...Now is there a way to clobber the default stop-transcript then call the original.
Will suggested that I look at http://blogs.technet.com/b/heyscriptingguy/archive/2010/09/25/create-a-transcript-of-commands-from-the-windows-powershell-ise.aspx. This had a ISETranscript that pulled the detail from the output pane. I combined this with a function I saw yesterday on poshcode that implemented an Out-ISEFileTab process. Combined they make the above.