ntdevlabs / tiny11builder

Scripts to build a trimmed-down Windows 11 image.
9.87k stars 855 forks source link

Start-Transcript : Transcription cannot be started. #229

Open reenberg opened 3 months ago

reenberg commented 3 months ago

If the script failed, and the script is run again, then it throws the following error:

Start-Transcript : Transcription cannot be started.
At D:\tiny11builder-main\tiny11maker.ps1:42 char:1
+ Start-Transcript -Path "$PSScriptRoot\tiny11.log"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Start-Transcript], PSInvalidOperationException
    + FullyQualifiedErrorId : CannotStartTranscription,Microsoft.PowerShell.Commands.StartTranscriptCommand

It seems that the script should either try to stop a previous transcript befor starting a new one, or even better, have a finally block that would stop the transcript when the script exits, even if it fails.

I am running the following version of pwershell in a freshly installed Windows 11:

> write $PSVersionTable

Name                           Value                                                                                                                            
----                           -----                                                                                                                            
PSVersion                      5.1.22621.3880                                                                                                                   
PSEdition                      Desktop                                                                                                                          
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                                                          
BuildVersion                   10.0.22621.3880                                                                                                                  
CLRVersion                     4.0.30319.42000                                                                                                                  
WSManStackVersion              3.0                                                                                                                              
PSRemotingProtocolVersion      2.3                                                                                                                              
SerializationVersion           1.1.0.1