The Pesky Windows Power Plan Oh My

Edward Pochinski, 2018-11-06 (first published: 2018-10-19)

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)

Related content

Check SQL Server Virtual Log Files Using PowerShell

In a previous tip on Monitor Your SQL Server Virtual Log Files with Policy Based Management, we have seen how we can use Policy Based Management to monitor the number of virtual log files (VLFs) in our SQL Server databases. However, even with that most of the solutions I see online involve the creation of temporary tables and/or a combination of using cursors to get the total number of VLFs in a transaction log file. Is there a much easier solution?

Additional Articles

2012-10-11

3,321 reads