Skip to content

Instantly share code, notes, and snippets.

@marvinlehmann
Created October 26, 2022 14:58
Show Gist options
  • Save marvinlehmann/194a95ce14bad67d2680992c20950f79 to your computer and use it in GitHub Desktop.
Save marvinlehmann/194a95ce14bad67d2680992c20950f79 to your computer and use it in GitHub Desktop.
How to enable Wake-On-Lan on Windows 10 using PowerShell

Settings for Wake-On-Lan

0. Enabling it in BIOS/UEFI

1. Disabling fast startup and/or hibernation

Turning off fast startup:

New-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Power" -Name HiberbootEnabled -PropertyType DWord -Value 0 -Force

Disabling hibernation, which disables fast startup too (?): POWERCFG /HIBERNATE OFF

2. NIC Power Management

2.1: Checking "Allow the computer to turn off this device to save power"

$Adapter = Get-NetAdapter -Physical | Where-Object { $_.PhysicalMediaType -eq "802.3" } | Get-NetAdapterPowerManagement | Where-Object { $_.AllowComputerToTurnOffDevice -ne "Unsupported" }
$Adapter.AllowComputerToTurnOffDevice = "Enabled"
$Adapter | Set-NetAdapterPowerManagement

2.2: Checking "Allow this device to wake the computer"

$PnPDeviceID = Get-NetAdapter -Physical | Where-Object { $_.PhysicalMediaType -eq "802.3" }
  | Select-Object -First 1 -ExpandProperty PnPDeviceID # only getting first one here for illustration...

Get-CimInstance -ClassName MSPower_DeviceWakeEnable -Namespace root/wmi
  | Where-Object { $_.InstanceName -Match [regex]::escape($PnPDeviceID) }
    | Set-CimInstance -Property @{Enable=$True}

2.3: Checking "Only allow a magic packet to wake the computer"

$PnPDeviceID = Get-NetAdapter -Physical | Where-Object { $_.PhysicalMediaType -eq "802.3" }
  | Select-Object -First 1 -ExpandProperty PnPDeviceID # only getting first one here for illustration...

Get-CimInstance -ClassName MSNdis_DeviceWakeOnMagicPacketOnly -Namespace root/wmi
  | Where-Object { $_.InstanceName -Match [regex]::escape($PnPDeviceID) }
    | Set-CimInstance -Property @{EnableWakeOnMagicPacketOnly=$true}

3. Advanced NetAdapter Properties

  • EnablePME (Intel also calls it "Wake on Magic Packet from power off state"): Enabled
  • Wake on Magic Packet: Enabled
  • Wake on Pattern Match: Enabled
  • Energy Efficient Ethernet: Disabled? (mentioned in some instructions e.g. by DELL - for me it didn't matter)
$Adapter | Set-NetAdapterPowerManagement -WakeOnMagicPacket Enabled
$Adapter | Set-NetAdapterPowerManagement -WakeOnPattern Enabled
$Adapter | Set-NetAdapterAdvancedProperty -RegistryKeyword EnablePME -RegistryValue 1
# wasn't needed for me:
$Adapter | Set-NetAdapterAdvancedProperty -RegistryKeyword EEELinkAdvertisement -RegistryValue 0 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment