Enable WOL in the BIOS for Dell, HP and Lenovo devices

We have created a Enable-WOL script to enable Wake on Lan in the BIOS for Dell, HP en Lenovo devices.

But unfortunately this script doesn’t work.

We have created this script:

Note This script has not been tested rigorously - 2021-03-11 - Merge Requests accepted!

$Manufacturer = Get-WmiObject Win32_Computersystem -Property Manufacturer | select -ExpandProperty manufacturer
if($Manufacturer -like “Dell*”)
{
if((Get-Module -ListAvailable -Name DellBiosProvider) -eq $null)
{
Install-Module DellBiosProvider -Confirm:$false -Force
}
Import-Module DellBiosProvider

$WakeOnLanDisabled = (Get-Item “DellSmbios:\PowerManagement\WakeOnlan” | select -ExpandProperty CurrentValue) -like “Disabled”
if($WakeOnLanDisabled)
{
“WakeOnLan is Disabled…Enabling”
Set-Item “DellSmbios:\PowerManagement\WakeOnlan” -Value LanWlan
}
else
{
“WakeOnLan already enabled”
}
}
elseif($Manufacturer -like “hp”)
{
$WMI = Get-WmiObject -Namespace “root\hp\instrumentedBIOS” -Class hp_biosSetting -ErrorAction Stop | where { ![string]::IsNullOrWhiteSpace($.Name) -and $.Name -like “S5 Wake on LAN”} | select Name,Value,IsReadOnly | Sort-Object name
$WakeOnLanDisabled = ($WMI | select -ExpandProperty Value) -match “*Disable”
if($WakeOnLanDisabled)
{
“WakeOnLan is Disabled…Enabling”
$setBiosSetting = Get-WmiObject -Namespace “root\hp\instrumentedbios” -Class HP_BiosSettingInterface
$setBiosSetting.SetBIOSSetting(“S5 Wake on LAN”,“Enable”)
}
else
{
“WakeOnLan already enabled”
}
}
elseif($manufacturer -like “lenovo”)
{
$WMI = Get-WmiObject -class Lenovo_BiosSetting -namespace “root\wmi”
$BIOSsettings = New-Object PSObject
$BIOSsettings | Add-Member -MemberType NoteProperty -Name ‘ComputerName’ -Value $WMI[0].__Server
$WMI | ?{![string]::IsNullOrWhiteSpace($.CurrentSetting)}| %{
$Setting = $
.CurrentSetting -split ‘,’;
$BIOSsettings | Add-Member -MemberType NoteProperty -Name $Setting[0] -Value $Setting[1] -Force;
}

$WakeOnLanDisabled = ($BIOSSettings | select -ExpandProperty wakeonlan) -like “Disable”

if($WakeOnLanDisabled)
{
“WakeOnLan is Disabled…Enabling”
(gwmi -class Lenovo_SetBiosSetting –namespace root\wmi).SetBiosSetting(“WakeOnLAN,ACOnly”)
(gwmi -class Lenovo_SaveBiosSettings -namespace root\wmi).SaveBiosSettings()
}
else
{
“WakeOnLan already enabled”
}
}

Could you provide us with a script that enables Wake on Lan in the bios?

This would be really amazing to have!

According to @DarrenDK I should be able to leverage the child actions introduced in 0.55 release to install the prerequisite VC++ libraries for the Dell powershell module. Once I have that, I already have working BIOS code for Dell and HP in my own instance, and I would just need someone with lots of Lenovos to help me with that part. Once I have that, I will be adding the BIOS settings changes to the global Enable Wake On LAN for Windows task that I put in the global repo early last year.

1 Like

Tagging onto this convo after a discussion with support today as part of our onboarding for client systems is to make some BIOS configuration changes that are dependent upon whether the system is a laptop or desktop. This is fairly easy on Dell systems as you manually configure one system, capture the config settings using Dell Command Configure then run an EXE on all other systems. Running the EXE is certainly easy to script.

However, it’s less easy on Lenovo systems as they require a stand alone application to write to the BIOS. I’ve not had the pleasure of automating these changes on an HP system yet so I can’t speak to the complexity of accomplishing it on those systems, or the lack thereof.

It appears that using the Set-BIOS module in powershell could be a good option for accomplishing this task. Is using the Set-BIOS module something that has been investigated for use by Immy to change more than just the WOL setting?

I know for HPs it is possible to use WMI to set BIOS options, I thought I remembered the same being true for some Lenovos. I only have a single Lenovo for testing (have had for a couple of months now), so I can revisit.

I still need child actions implemented–it was pulled in 0.55 because of a design flaw (my description) where I couldn’t append child actions after the initial detection, and I demonstrated the necessity of this with Windows Update.

@DarrenDK wants BIOS options implemented alongside their respective tasks–like Bitlocker enabling the TPM Bios options (for example), and the WOL settings added to the Wake-On-LAN Windows script that I did also.

Lenovo’s use WMI and they have some documentation on it so you could easily use PowerShell. Dell has the bios powershell module and HP you can use WMI or there is also an HP powershell module.

The common settings that we deploy on desktops, for example, are disabling sleep and configuring an auto-on time of midnight every day to allow for overnight patching/updates. AC reconnect to powered on state, disabling sleep on desktops, etc. These options all exist across manufacturers but wording for each is slightly different.