The Pesky Windows Power Plan Oh My

,

The Default Windows Power Plan seems to be causing me some headaches on some busy SQL engines. Ok so if I had it my way I would have the DBA IO Tools, setup to update and use. That is some amazaing work ! But I belive this would have to pass throuh security at the company I work at. SO what to do, I checked Chrissy LemMaire's site, looked pretty doable. The PS Code will build you a nice csv for quickly importing into a SQL table. I hope you may be able to make use of the code.

foreach ($server in get-content "E:\WMI\POwerSettings\Serverbatch3.txt")
{
$PowerPlanlogfile="E:\WMI\POwerSettings\output\PowerPlanlogfile_10182018.txt"
Write-host "Getting Power Plan information from $server." -ForegroundColor Green
                 $query = "Select ElementName from Win32_PowerPlan WHERE IsActive = 'true'" 
                  $currentplan = Get-WmiObject -Namespace Root\CIMV2\Power -ComputerName $server -Query $query -ErrorAction SilentlyContinue 
                  $currentplan = $currentplan.ElementName
                  $currentplan=($server + "," + $currentplan)
                   $currentplan | Out-File -FilePath $PowerPlanlogfile -Append
}

Rate

2.5 (2)

Share

Share

Rate

2.5 (2)