Last active
August 29, 2015 13:56
-
-
Save jstrassburg/9214831 to your computer and use it in GitHub Desktop.
Log PowerShell commands with Start-Transcript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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