microsoft/Get-NetView

Transcript output points user to incorrect log location

Closed this issue · 0 comments

Hi!

Since Start-Transcript outputs to "$OutDir\Get-NetView.log", when stopped, host output points to $OutDir. Since the log actually gets moved to "$OutDir_Logs", users aren't aware of where to go for the actual Get-NetView.log.

For potential mitigation, can think of two options:
1)
Pipe Stop-Transcript to Out-Null;
After moving the file, Write-Output your own message pointing to "$logDir\Get-NetView.log" in the try/catch blocks for Stop-Transcript.
2)
Define $logDir in the "Initialize" function instead of "Completion";
Change the Path for Start-Transcript to "$logDir\Get-NetView.log";
Remove Move-Item from the Stop-Transcript try block.

Without knowing what else could break by moving things in option #2, I'd suggestion option #1.

Line  | Code
----- | ------------------
2648  | Stop-Transcript | Out-Null
2649  | <...>
2650  | Write-Output "Transcript stopped, output file is $logDir\Get-NetView.log"