pátek 30. září 2016

Kontrola - NIC Power Management

Našel jsem na Internetu následující script - NIC Power Management, který provede kontrolu nastavení síťové karty (z pohledu doporučení Microsoft).



cls
write-host "
Checking your NIC Power Settings now....." -ForegroundColor cyan;write-host " "
$NICs = Get-WmiObject -Class Win32_NetworkAdapter|Where-Object{$_.PNPDeviceID -notlike "ROOT\*" -and $_.Manufacturer -ne "Microsoft" -and $_.ConfigManagerErrorCode -eq 0 -and $_.ConfigManagerErrorCode -ne 22}

Foreach($NIC in $NICs) {
$NICName = $NIC.Name
$DeviceID = $NIC.DeviceID
If([Int32]$DeviceID -lt 10) {
$DeviceNumber = "000"+$DeviceID
} Else {
$DeviceNumber = "00"+$DeviceID
}

$KeyPath = "HKLM:\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\$DeviceNumber"

If(Test-Path -Path $KeyPath) {
$PnPCapabilities = (Get-ItemProperty -Path $KeyPath).PnPCapabilities
If($PnPCapabilities -eq 0){Set-ItemProperty -Path $KeyPath -Name "PnPCapabilities" -Value 24 | Out-Null}
If($PnPCapabilities -eq $null){Set-ItemProperty -Path $KeyPath -Name "PnPCapabilities" -Value 24 | Out-Null}
If($PnPCapabilities -eq 24) {write-host "Power Management has already been " -NoNewline;write-host "disabled" -ForegroundColor Green}
If($PnPCapabilities -ne 24) {
Write-host "
The value of "-nonewline;write-host $PnPCapabilities -foregroundcolor red -nonewline;write-host " was not expected.";write-host " "
write-host "
Would you like to change the Power Management setting for your NIC to none? [y or n] " -nonewline
$choice = read-host
if ($choice -eq 'y') {Set-ItemProperty -Path $KeyPath -Name "PnPCapabilities" -Value 24 | Out-Null}
else {write-host " ";write-host "
If this is an Exchange 2013/2016 server, you should turn off the Power Management settings." -ForegroundColor Yellow;write-host " "
}
}
}
}


Zdroj:

Žádné komentáře:

Okomentovat