Windows 10 | WakeOnLan | GPO via powershell

You have a problem with running WOL properly on Windows 10 in a corporate environment?
Distribute a powershell (argghhh) script like this via GPO.
All 192.168 NICs are renamed into a standard OFFICEN (OFFICE1..999).

$adapter = gwmi win32_networkadapterconfiguration | ? { $_.IPaddress -like "*192.168*"}
$i = 1
foreach($element in $adapter){
    $adapterindex = $element.index
    $newname = "OFFICE"+$i
    $adapterID = gwmi win32_networkadapter | ?{$_.index -eq $adapterindex}
    $adapter = ($adapterID).NetConnectionID
    $input = @"
    interface set interface "$adapter" newname="$newname"
    exit
    "@
    $input
    $input | netsh
    $i++
}
$i = 1
foreach($element in $adapter){
    $name = "OFFICE"+$i
    Set-NetAdapterPowerManagement  -NoRestart -Name "$name" -DeviceSleepOnDisconnect Disabled -SelectiveSuspend Disabled -WakeOnMagicPacket Enabled
    Disable-NetAdapterPowerManagement -Name "$name"
    $i++
}

# LENOVO # INTEL I219-V
Get-NetAdapter -Physical | where InterfaceDescription -eq "Intel(R) Ethernet Connection (7) I219-V" | Set-NetAdapterAdvancedProperty -NoRestart -DisplayName "Energieeffizientes Ethernet" -DisplayValue "Aus"
Get-NetAdapter -Physical | where InterfaceDescription -eq "Intel(R) Ethernet Connection (7) I219-V" | Set-NetAdapterAdvancedProperty -NoRestart -DisplayName 'Akt. über Magic Packet' -DisplayValue 'Aktiviert'
# HP # REALTEK PCIe GbE
Get-NetAdapter -Physical | where InterfaceDescription -eq "Realtek*" | Set-NetAdapterAdvancedProperty -NoRestart -DisplayName "Bei Magic Packet aufwecken" -DisplayValue "Aktiviert"
Get-NetAdapter -Physical | where InterfaceDescription -eq "Realtek*" | Set-NetAdapterAdvancedProperty -NoRestart -DisplayName "Energy-Efficient Ethernet (LAN-Energiesparen, EEE)" -DisplayValue "Deaktiviert"
#Get-NetAdapter -Physical | where InterfaceDescription -eq "Realtek*" | Set-NetAdapterAdvancedProperty -NoRestart -RegistryKeyword "EEE" -RegistryType "REG_SZ" -RegistryValue "0"
#END

Every vendor use different NIC properties. To check out your specific card you simply run

Get-NetAdapterAdvancedProperty OFFICE1 -AllProperties | Format-List -Property "*"

It is mostly possible to set a DisplayName/DisplayValue or a RegistryKeyword/RegistryValue combo.
Before beeing able to set these parameters you will need the exact NICs name. I solved this problem by renaming all NICs belonging to a defined subnet to a standard id.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.