function Reset-WebTestLogFolder { <# .SYNOPSIS Reset the folder for web tests so this run is pristine .DESCRIPTION The impetus for this change is that some things were breaking unexpectedly during testing and crashing the entire host. We needed a way to track where it was crashing the host mid-process. Hence this function and .. Write-* "message" becomes "message" | Tee-Object -Append -Path $thisPath | Write-* .PARAMETER BaseLogFileName [Required] [string] The bank url to log for #> [CmdletBinding()] param( [Parameter(Mandatory = $true)] [Alias("LogFileName")] [string]$BaseLogFileName ) $logFilePath = (Join-Path (Get-OrbLogsPath) WebTests) if (!(Test-Path $logFilePath)) { (New-Item -ItemType Directory -Path $logFilePath -Force) | Out-Null } $archiveFolderPath = (Join-Path $logFilePath Archive) if (!(Test-Path $archiveFolderPath)) { (New-Item -ItemType Directory -Path $archiveFolderPath -Force) | Out-Null } $baseLogFilePath = (Join-Path $logFilePath "$BaseLogFileName.log") if (Test-Path $baseLogFilePath) { $timestamp = (Get-Item $baseLogFilePath).CreationTime.ToString("yyyyMMddhhmm") $zipFilePath = (Join-Path $archiveFolderPath "$BaseLogFileName.$timestamp.zip") $files = (Get-ChildItem -File -Path $logFilePath).FullName (Compress-Archive -DestinationPath $zipFilePath -Path $files -Force) | Out-Null (Remove-Item -Path $files -Force) | Out-Null } }