My Script contains the command Start-Transcript, which is creating a log file.
If I start the PowerShell.exe and call the Script it is creating the log file correctly.
If I start the script on the ISE, it gives me an error (This Host doens’t support Logs/Records):
Start-Transcript : Dieser Host unterstützt keine Aufzeichnungen.
Bei Zeile:12 Zeichen:17
+ Start-Transcript <<<< "C:\transcripts\transcript0.txt" -Path -Force
+ CategoryInfo : NotImplemented: (:) [Start-Transcript], PSNotSupportedException
+ FullyQualifiedErrorId : NotSupported,Microsoft.PowerShell.Commands.StartTranscriptCommand
But if I run the script as a Post Build Event, it is not logging.
Can anybody explain me why the script is losing the information of the transript if I start itself with Visual Studio (2013 Professional)?
powershell.exe -executionpolicy bypass -file "$(SolutionDir)PSTranscriptTest.ps1"
My PSVersion-Infos:
4> Name Value
4> ---- -----
4> CLRVersion 2.0.50727.5485
4> BuildVersion 6.1.7601.17514
4> PSVersion 2.0
4> WSManStackVersion 2.0
4> PSCompatibleVersions {1.0, 2.0}
4> SerializationVersion 1.1.0.1
4> PSRemotingProtocolVersion 2.1
My Script contains:
Start-Transcript -Path "C:\transcripts\transcript0.txt" -Force
Write-Host "Test With Write Host"
Write-Output "Test With Write Output"
Verbose "Test With Verbose"
$PSVersionTable
Stop-Transcript
The Output to Screen works. But not to the file.
The file contains:
**********************
Start der Windows PowerShell-Aufzeichnung
Startzeit: 20170302100746
Benutzername: User-PC\User
Computer: USER-PC (Microsoft Windows NT 6.1.7601 Service Pack 1)
**********************
**********************
Ende der Windows PowerShell-Aufzeichnung
Endzeit: 20170302100746
**********************