Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save littletoyrobots/da3b4734f9c4791e7c1f4fabcccbabfd to your computer and use it in GitHub Desktop.

Select an option

Save littletoyrobots/da3b4734f9c4791e7c1f4fabcccbabfd to your computer and use it in GitHub Desktop.
Write-Verbose "Disable power saving on hardware network interfaces"
foreach ($NIC in (Get-NetAdapter -Physical)) {
$PowerSaving = Get-CimInstance -ClassName MSPower_DeviceEnable -Namespace root\wmi | Where-Object { $_.InstanceName -match [Regex]::Escape($NIC.PnPDeviceID) }
if ($PowerSaving.Enable) {
$PowerSaving.Enable = $false
$PowerSaving | Set-CimInstance *>&1
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment