Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
Try the new cross-platform PowerShell https://aka.ms/pscore6
PS C:\WINDOWS\system32> <# : batch script
>> @echo off
>> PowerShell.exe -NoProfile Invoke-Expression ([System.IO.File]::ReadAllText('%0'))
>> goto :eof
>> #>
>>
>> [CmdletBinding(SupportsShouldProcess=$false)]
>> Param()
>>
>> Set-StrictMode -Version 'latest'
>>
>> function Test-RunningAsAdmin
>> {
>> [System.Security.Principal.WindowsIdentity]$currentIdentity = [System.Security.Principal.WindowsIdentity]::GetCurrent()
>> [System.Security.Principal.WindowsPrincipal]$currentPrincipal = [System.Security.Principal.WindowsPrincipal]::new($currentIdentity)
>>
>> Write-Output ($currentPrincipal.IsInRole([System.Security.Principal.WindowsBuiltInRole]::Administrator))
>> }
>>
>> $InformationPreference = [Management.Automation.ActionPreference]::Continue
>>
>> if (-not (Test-RunningAsAdmin))
>> {
>> Write-Warning 'This script requires administrator privileges! Please restart it by running it as an administrator.'
>> }
>> else
>> {
>> [string]$temporaryFolderPath = [string]::Empty
>>
>> do
>> {
>> $temporaryFolderPath = [IO.Path]::GetTempFileName()
>> if (Test-Path $temporaryFolderPath) { Remove-Item -Path $temporaryFolderPath -Recurse -Force }
>> } while ((-not ([string]::IsNullOrEmpty($temporaryFolderPath))) -and (Test-Path -Path $temporaryFolderPath))
>>
>> # Create the temporary folder if it does not exist.
>> if (-not (Test-Path -Path $temporaryFolderPath)) { New-Item -Path $temporaryFolderPath -ItemType 'Directory' | Out-Null }
>>
>> # Clear any existing contents of the temporary folder.
>> Get-ChildItem -Path $temporaryFolderPath -Force | Remove-Item -Recurse -Force
>>
>> [string]$logFilePath = Join-Path -Path $temporaryFolderPath -ChildPath 'powercfg-info.txt'
>> if (Test-Path -Path $logFilePath) { Remove-Item -Path $logFilePath -ErrorAction SilentlyContinue }
>>
>> [string]$powercfgPath = Join-Path ([System.Environment]::SystemDirectory) 'powercfg.exe'
>>
>> [System.Diagnostics.ProcessStartInfo]$startInfo = [System.Diagnostics.ProcessStartInfo]::new()
>> $startInfo.FileName = $powercfgPath
>> $startInfo.UseShellExecute = $false
>> $startInfo.RedirectStandardOutput = $true
>> $startInfo.RedirectStandardError = $true
>>
>> if (Test-Path -Path $powercfgPath)
>> {
>> [string]$energyReportPath = Join-Path -Path $temporaryFolderPath -ChildPath 'energy-report.html'
>> [string]$batteryReportPath = Join-Path -Path $temporaryFolderPath -ChildPath 'battery-report.html'
>> [string]$sleepStudyReportPath = Join-Path -Path $temporaryFolderPath -ChildPath 'sleepstudy-report.html'
>> ## [string]$sleepDiagnosticsReportPath = Join-Path -Path $temporaryFolderPath -ChildPath 'sleep-diagnostics-report.html'
>> ## [string]$systemPowerReportPath = Join-Path -Path $temporaryFolderPath -ChildPath 'system-power-report.html'
>>
>> @('/list',
>> '/availablesleepstates',
>> '/lastwake',
>> '/devicequery wake_armed',
>> '/waketimers',
>> '/requests',
>> "/energy /output `"$($energyReportPath)`" /duration 10",
>> "/batteryreport /output `"$($batteryReportPath)`"",
>> "/sleepstudy /output `"$($sleepStudyReportPath)`""
>> ## "/systemsleepdiagnostics /output `"$($sleepDiagnosticsReportPath)`"", # Command is deprecated.
>> ## "/systempowerreport /output `"$($systemPowerReportPath)`"" # Generates the same report as /sleepstudy.
>> ) |
>> ForEach-Object {
>> Write-Output "Running PowerCfg $($_)" | Tee-Object -FilePath $logFilePath -Append
>>
>> $startInfo.Arguments = @($_)
>>
>> [System.Diagnostics.Process]$dsRegCmdProcess = [System.Diagnostics.Process]::new()
>> $dsRegCmdProcess.StartInfo = $startInfo
>> $dsRegCmdProcess.Start() | Out-Null
>>
>> Write-Output $dsRegCmdProcess.StandardOutput.ReadToEnd() | Out-String | Tee-Object -FilePath $logFilePath -Append
>> }
>> }
>> else
>> {
>> Write-Warning "$($powercfgPath) does not exist!"
>> }
>>
>> [string]$zipFilePath = "powercfg_info_$(Get-Date -Format 'yyyy-MM-dd_HH-mm-ss').zip"
>> [System.IO.Path]::GetInvalidFileNameChars() | ForEach-Object { $zipFilePath = $zipFilePath -replace "\$($_)", [string]::Empty }
>> $zipFilePath = Join-Path ([Environment]::GetFolderPath([Environment+SpecialFolder]::DesktopDirectory)) $zipFilePath
>>
>> 1..2 | ForEach-Object { Write-Information ([string]::Empty) } # Write some empty lines, just for spacing.
>> Write-Information "Compressing gathered files into a .zip archive..."
>> Get-ChildItem -Path $temporaryFolderPath |
>> ForEach-Object {
>> Compress-Archive -Path ($_.FullName) -Update -DestinationPath $zipFilePath
>> Start-Sleep -Seconds 1
>> Remove-Item -Path $_.FullName -Recurse -Force
>> }
>>
>> 1..5 | ForEach-Object { Write-Information ([string]::Empty) } # Write some empty lines, just for spacing.
>> Write-Information "The PowerCfg report files have been gathered into a .zip file on your desktop,"
>> Write-Information "$($zipFilePath)."
>> Write-Information "Please upload the file as an attachment to your post on the forum."
>>
>> Remove-Item -Path $temporaryFolderPath -Recurse -Force
>> }
>>
>> pause
Running PowerCfg /list
Existing Power Schemes (* Active)
-----------------------------------
Power Scheme GUID: 381b4222-f694-41f0-9685-ff5bb260df2e (Balanced)
Power Scheme GUID: 8759706d-706b-4c22-b2ec-f91e1ef6ed38 (HP Optimized (recommended)) *
Running PowerCfg /availablesleepstates
The following sleep states are available on this system:
Standby (S3)
The following sleep states are not available on this system:
Standby (S1)
The system firmware does not support this standby state.
Standby (S2)
The system firmware does not support this standby state.
Hibernate
Hibernation has not been enabled.
Standby (S0 Low Power Idle)
The system firmware does not support this standby state.
Hybrid Sleep
Hibernation is not available.
Fast Startup
Hibernation is not available.
Running PowerCfg /lastwake
Wake History Count - 0
Running PowerCfg /devicequery wake_armed
NONE
Running PowerCfg /waketimers
Timer set by [PROCESS] \Device\HarddiskVolume4\Windows\SystemApps\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy\StartMenuExperienceHost.exe expires at 4:00:00 AM on ?~Z.
Running PowerCfg /requests DISPLAY: None. SYSTEM: None.
AWAYMODE:
None.
EXECUTION:
None.
PERFBOOST:
None.
ACTIVELOCKSCREEN:
None.
Running PowerCfg /energy /output "C:\Users\aaaaaaaa\AppData\Local\Temp\tmp77B4.tmp\energy-report.html" /duration 10
Enabling tracing for 10 seconds...
Observing system behavior...
Analyzing trace data...
Analysis complete.
Energy efficiency problems were found.
4 Errors
5 Warnings
85 Informational
See C:\Users\aaaaaaaa\AppData\Local\Temp\tmp77B4.tmp\energy-report.html for more details.
Running PowerCfg /batteryreport /output "C:\Users\aaaaaaaa\AppData\Local\Temp\tmp77B4.tmp\battery-report.html"
Battery life report saved to file path C:\Users\aaaaaaaa\AppData\Local\Temp\tmp77B4.tmp\battery-report.html.
Running PowerCfg /sleepstudy /output "C:\Users\aaaaaaaa\AppData\Local\Temp\tmp77B4.tmp\sleepstudy-report.html"
Sleep Study report saved to file path C:\Users\aaaaaaaa\AppData\Local\Temp\tmp77B4.tmp\sleepstudy-report.html.
Compressing gathered files into a .zip archive...
The PowerCfg report files have been gathered into a .zip file on your desktop,
C:\Users\aaaaaaaa\Desktop\powercfg_info_2026-10-20_17-15-27.zip.
Please upload the file as an attachment to your post on the forum.
Press Enter to continue...: