Search code examples
powershellwake-on-lan

Remotely Enable Wakeup from Shutdown


I am trying to get 400 pcs setup to wake on lan. everything is enabled on all the pcs but one check box. Under the advanced tab on the nic, "wakeup from Shutdown" is disabled and I need to enable it on all pcs.

I have a working script to change the boxes under the power management tab but those are already checked. but I cant seem to find any info about anything under the advanced tab. properties on nic, configure, advanced)

Any help in figuring out if this is possible would be a big help. Could I edit that code to just enable what I need? or simpler to write a new one?

I haven't tried anything cause I cant seem to find any info as to if this is even possible. im thinking its just a different wmi object (probably wrong name) but in my code that works I found the lines that go to each check box and am wondering if there is a class for "wakeup from shutdown"

*** line im curious about

foreach ($NIC in $NICs) {
    $Errors = $false
    Write-Host "NIC:"$NIC.Name
    #Allow the computer to turn off this device
    Write-Host "Allow the computer to turn off this    device....."      -NoNewline
    ***$NICPowerManage = Get-WmiObject MSPower_DeviceEnable    -Namespace root\wmi | Where-Object { $_.instancename -match [regex]::escape ($nic.PNPDeviceID) }
    If ($NICPowerManage.Enable -ne $TurnOffDevice) {
        $NICPowerManage.Enable = $TurnOffDevice
        $HideOutput = $NICPowerManage.psbase.Put()
    }
    If ($NICPowerManage.Enable -eq $TurnOffDevice) {
        Write-Host "Success" -ForegroundColor Yellow
    } else {
        Write-Host "Failed" -ForegroundColor Red
        $Errors = $true

OTHER LINES

Get-WmiObject MSNdis_DeviceWakeOnMagicPacketOnly -Namespace root\wmi | Where-Object { $_.instancename -match [regex]::escape($nic.PNPDeviceID) }

Solution

  • I use this little tool called WMIExplorer.exe to navigate WMI. I think MSPower_DeviceWakeEnable is the class you are looking for.

    After a few searches, I stumbled upon this. Perhaps that is similar to your problem. https://www.itinsights.org/Enable-wake-on-lan-WOL-with-PowerShell/

    enter image description here