Skip to content

Instantly share code, notes, and snippets.

@leachdaniel
Created February 26, 2018 00:10
Show Gist options
  • Save leachdaniel/93e2575a721ae8cb04271459b58e0856 to your computer and use it in GitHub Desktop.
Save leachdaniel/93e2575a721ae8cb04271459b58e0856 to your computer and use it in GitHub Desktop.
Save Transcript for Command Block
function SaveTranscript($tempDir, $actionName, $block)
{
$fileName = "$tempDir\Transcripts\$actionName.txt"
try
{
Stop-Transcript | out-null
} catch { }
Start-Transcript -path $fileName -append
try {
& $block
}
finally {
Stop-Transcript
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment