delete existing reports with same name
This commit is contained in:
@@ -12,6 +12,10 @@ $ReportPathNoExt = "${OutputDirectory}\batteryreport_${Env:COMPUTERNAME}_${Today
|
|||||||
$HtmlReportPath = $ReportPathNoExt + '.html'
|
$HtmlReportPath = $ReportPathNoExt + '.html'
|
||||||
$XmlReportPath = $ReportPathNoExt + '.xml'
|
$XmlReportPath = $ReportPathNoExt + '.xml'
|
||||||
|
|
||||||
|
# Delete reports if they already exist
|
||||||
|
If ( Test-Path $XmlReportPath ) { Remove-Item -Path $XmlReportPath -Force }
|
||||||
|
If ( Test-Path $HtmlReportPath ) { Remove-Item -Path $HtmlReportPath -Force }
|
||||||
|
|
||||||
# Generate the XML report
|
# Generate the XML report
|
||||||
Write-Output "Generating XML battery report: ${XmlReportPath}"
|
Write-Output "Generating XML battery report: ${XmlReportPath}"
|
||||||
Try { Start-Process "powercfg.exe" -ArgumentList "/batteryreport /output ""${XmlReportPath}"" /xml" -Wait }
|
Try { Start-Process "powercfg.exe" -ArgumentList "/batteryreport /output ""${XmlReportPath}"" /xml" -Wait }
|
||||||
|
|||||||
Reference in New Issue
Block a user