source/99_Function/LogX.ps1
Function LogEnd { $txnLog = "" Do { try { Stop-Transcript | Out-Null } catch [System.InvalidOperationException] { $txnLog = "stopped" } } While ($txnLog -ne "stopped") } Function LogStart { param ( [Parameter(Mandatory = $true)] [string]$logPath ) LogEnd Start-Transcript $logPath -Force | Out-Null } |