Start-Transcript: This host does not support transcription

前端 未结 7 2035
难免孤独
难免孤独 2021-02-05 04:50

I want to start a transcript on a Windows Server 2008 R2

Start-Transcript -path C:\\Temp\\test.txt
\"Hello!\"
Stop-Transcript

But PowerShe

7条回答
  •  一整个雨季
    2021-02-05 05:34

    The powershell.exe will also generate this error if there is a problem writing to the log file. For example, if the log file was created by an administrator and the user doesn't have permissions to overwrite the log.

    Start-Transcript : The host is not currently transcribing.
    At D:\Test1.ps1:9 char:1
    + Start-Transcript -Path "$Source\logs\Test.txt"
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Start-Transcript], PSInvalidOperationException
    + FullyQualifiedErrorId : InvalidOperation,Microsoft.PowerShell.Commands.StartTranscriptCommand
    

    A good solution is to try using -Append or to make the log file unique by generating a date/time stamp.

    Start-Transcript -Path "$Source\logs\Test.txt" -Append
    

    This way a proper error message is generated.

    Access to the path 'D:\Test\logs\Test.txt' is denied.
    

    -Force has the same effect as -Append and will generate a permissions error.

提交回复
热议问题