Skip to content

Instantly share code, notes, and snippets.

@jstrassburg
Last active August 29, 2015 13:56
Show Gist options
  • Save jstrassburg/9214831 to your computer and use it in GitHub Desktop.
Save jstrassburg/9214831 to your computer and use it in GitHub Desktop.
Log PowerShell commands with Start-Transcript
$logFile = ".\MyLogFile.log"
$ErrorActionPreference = "SilentlyContinue"
Stop-Transcript | Out-Null
$ErrorActionPreference = "Continue"
Start-Transcript -path $logFile
# Do Stuff
# If running commands with & some.exe pipe to Out-Default
& some.exe | Out-Default
Write-Host "Process Complete"
Stop-Transcript
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment