Skip to content

Commit

Permalink
WiP - replace Write-Log in remote script blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
Dhiren Vispute authored and Dhiren Vispute committed Mar 14, 2024
1 parent a83ee2e commit c5908c3
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions scripts/config_test_vm.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -223,14 +223,14 @@ function ArchiveKernelModeDump

# Create the compressed dump folder if doesn't exist.
if (!(Test-Path $KernelModeDumpFileDestinationPath)) {
Write-Log "Creating $KernelModeDumpFileDestinationPath directory."
Write-Output "Creating $KernelModeDumpFileDestinationPath directory."
New-Item -ItemType Directory -Path $KernelModeDumpFileDestinationPath

# Make sure it was created
if (!(Test-Path $KernelModeDumpFileDestinationPath)) {
$ErrorMessage = `
"*** ERROR *** Create compressed dump file directory failed: $KernelModeDumpFileDestinationPath`n"
Write-Log $ErrorMessage
Write-Output $ErrorMessage
Start-Sleep -seconds 3
Throw $ErrorMessage
}
Expand All @@ -240,11 +240,11 @@ function ArchiveKernelModeDump
Write-Log "Found kernel mode dump(s) in $($KernelModeDumpFileSourcePath):"
$DumpFiles = get-childitem -Path $KernelModeDumpFileSourcePath\*.dmp
foreach ($DumpFile in $DumpFiles) {
Write-Log "`tName:$($DumpFile.Name), Size:$((($DumpFile.Length) / 1MB).ToString("F2")) MB"
Write-Output "`tName:$($DumpFile.Name), Size:$((($DumpFile.Length) / 1MB).ToString("F2")) MB"
}
Write-Log "`n"
Write-Output "`n"

Write-Log `
Write-Output `
"Compressing kernel dump files: $KernelModeDumpFileSourcePath -> $KernelModeDumpFileDestinationPath"
Compress-Archive `
-Path $KernelModeDumpFileSourcePath\*.dmp `
Expand All @@ -254,12 +254,12 @@ function ArchiveKernelModeDump

if (Test-Path $KernelModeDumpFileDestinationPath\km_dumps.zip -PathType Leaf) {
$CompressedDumpFile = get-childitem -Path $KernelModeDumpFileDestinationPath\km_dumps.zip
Write-Log "Found compressed kernel mode dump file in $($KernelModeDumpFileDestinationPath):"
Write-Log `
Write-Output "Found compressed kernel mode dump file in $($KernelModeDumpFileDestinationPath):"
Write-Output `
"`tName:$($CompressedDumpFile.Name), Size:$((($CompressedDumpFile.Length) / 1MB).ToString("F2")) MB"
} else {
$ErrorMessage = "*** ERROR *** kernel mode dump compressed file not found.`n`n"
Write-Log $ErrorMessage
Write-Output $ErrorMessage
Start-Sleep -seconds 3
throw $ErrorMessage
}
Expand Down

0 comments on commit c5908c3

Please sign in to comment.