delete log file after Run-Script if it's empty
This commit is contained in:
@@ -149,9 +149,14 @@ Function Run-Script {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$LogFileContent = (Get-Content $LogFile)
|
||||
|
||||
## Write the log file output to the console
|
||||
If ( Test-Path $LogFile ) { Get-Content -Path $LogFile | Write-Output }
|
||||
Else { Write-Output "Log file not found at ""$LogFile""" }
|
||||
If ( $LogFileContent ) { Write-Output $LogFileContent }
|
||||
|
||||
## Delete the log file if it's empty
|
||||
Else { Remove-Item $LogFile -Force }
|
||||
}
|
||||
|
||||
## Return a Powershell version object from a string
|
||||
|
||||
Reference in New Issue
Block a user