Skip to content

Commit 02d52e6

Browse files
committed
Update 01_Server_Appliance.ps1
Added the Windows Power Plan
1 parent 2ec7e47 commit 02d52e6

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

Scripts/01_Server_Appliance.ps1

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ catch
250250
" " | out-file $fullFileName -Encoding ascii -Append
251251

252252
# Hardware
253+
# Motherboard
253254
# Turn off default Error Handler for WMI
254255
$old_ErrorActionPreference = $ErrorActionPreference
255256
$ErrorActionPreference = 'SilentlyContinue'
@@ -271,6 +272,7 @@ catch
271272

272273
" " | out-file $fullFileName -Encoding ascii -Append
273274

275+
# Proc, CPUs, Cores
274276
# Turn off default Error Handler for WMI
275277
$old_ErrorActionPreference = $ErrorActionPreference
276278
$ErrorActionPreference = 'SilentlyContinue'
@@ -294,6 +296,30 @@ catch
294296

295297
" " | out-file $fullFileName -Encoding ascii -Append
296298

299+
# PowerPlan
300+
# Turn off default Error Handler for WMI
301+
$old_ErrorActionPreference = $ErrorActionPreference
302+
$ErrorActionPreference = 'SilentlyContinue'
303+
304+
$mystring41 = Get-WmiObject -namespace "root\cimv2\power"class Win32_PowerPlan -ComputerName $server | where {$_.IsActive} | select ElementName
305+
306+
# Reset default PS error handler
307+
$ErrorActionPreference = $old_ErrorActionPreference
308+
309+
try
310+
{
311+
Write-output ("PowerPlan: {0} " -f $mystring41.ElementName)| out-file $fullFileName -Encoding ascii -Append
312+
}
313+
catch
314+
{
315+
Write-output "Error getting PowerPlan via WMI - WMI/Firewall issue? "| out-file $fullFileName -Encoding ascii -Append
316+
Write-output "Error getting PowerPlan via WMI - WMI/Firewall issue? "
317+
}
318+
319+
" " | out-file $fullFileName -Encoding ascii -Append
320+
321+
322+
297323
$mystring5 = "`r`nSQL Build reference: http://sqlserverbuilds.blogspot.com/ "
298324
$mystring5| out-file $fullFileName -Encoding ascii -Append
299325

0 commit comments

Comments
 (0)