In Configuration Manager a new way of waking up computers exists. We can Wake Up a single computer or all computers in a collection using the Client Notification channel, no need to configure Wake-On-LAN in Configuration Manager site settings and no need to ask the network team to turn on Subnet-Directed Broadcast. We tested it without anything configured as shown below:
The new Wake-Up feature will choose a computer on the same subnet as the computer you want to wake-up and send the magic packet on the local subnet. Simply great! If no other computer is turned on at that subnet, we get a message that no computer can wake-up the device.
This means that we can schedule a PowerShell script to wake a collection of Computers and how cool is that! More on that later in this post.
There is a new client setting that makes it easier to configure Wake-On Lan as well, under Power Management called “Allow network wake-up”
It configures the Network adapter in Windows to allow wake-on-lan as shown below, if we disable the client setting both wake up settings are deselected again.
A common question I have gotten many times are the need to wake computers in a schedule for example for patching. There is a method in WMI in Configuration Manager 1810 that can be used to wake up a single computer or a collection of computers using Powershell for example, which makes it possible to use the new Wake Up feature from a script.
The sample below can handle a single computername as input or a collectionID, Examples:
The script:
# Script to use client notification to Wake up a single computer or a collection of computers.
# Written by Johan Schrewelius and Jörgen Nilsson
# 2019-01-22 ccmexec.com
[CmdletBinding()]
Param(
$CmpName = $Null,
$CollId = "SMS00001",
$SiteServer = "SCCM01.test.local"
)
if (!$CmpName -and $CollId -eq "SMS00001") {
Write-Host "Seems wrong to wake every single computer in the environment, refusing to perform."
exit 1
}
$SiteCode = (Get-WmiObject -ComputerName "$SiteServer" -Namespace root\sms -Query 'SELECT SiteCode FROM SMS_ProviderLocation').SiteCode
if ($CmpName) {
$ResourceID = (Get-WmiObject -ComputerName "$SiteServer" -Namespace "Root\SMS\Site_$($SiteCode)" -Query "Select ResourceID from SMS_R_System Where NetBiosName = '$($CmpName)'").ResourceID
if ($ResourceID) {
$CmpName = @($ResourceID)
}
}
$WMIConnection = [WMICLASS]"\\$SiteServer\Root\SMS\Site_$($SiteCode):SMS_SleepServer"
$Params = $WMIConnection.psbase.GetMethodParameters("MachinesToWakeup")
$Params.MachineIDs = $CmpName
$Params.CollectionID = $CollId
$return = $WMIConnection.psbase.InvokeMethod("MachinesToWakeup", $Params, $Null)
if (!$return) {
Write-Host "No machines are online to wake up selected devices"
}
if ($return.numsleepers -ge 1) {
Write-Host "The resource selected are scheduled to wake-up as soon as possible"
}
The script can be downloaded here to avoid copy/paste errors: https://github.com/Ccmexec/PowerShell
To verify that it works, the normal WoL log files are not used but the Client Notification log files are so you can check for example BGBMGR.log file that the files are written to clients that will wake the client up.
There is still some configuration that must be done on some HW models in BIOS/Firmware to get Wake-On Lan running.
The new Wake Up option requires little or no network re-configuration which is great! Thanks Johan Schrewelius for a full day of testing!
Great post, thanks for sharing the information 😉
Amazing, I had tried getting this working but missed the fact you have to pass the CollectionID – doh!
Thanks for the post!
Running MECM 1910
Scratching my head. Try to figure out how to fix: Exception calling “InvokeMethod” with “3” argument(s): “Generic failure ” at filepath\filename
$return = $WMIConnection.psbase.InvokeMethod(“MachinesToWakeup”, $Par …
Are you seeing this?
The script works great for me.
What permissions do I need to provide a user. I have a user running this as admin on there local domain computer but returning an error.
I did create a security role with Notify resource under the Collection category. A Collection “All System”
Hi!
I am a network engineer, I have implemented large scale (16000 computers) WoL working with Dot1X.
We got it working fine with all normal WoL-clients where you can specify broadcast-addresses, but NOT with Microsofts Wakeup in CM.
This is because apperently, MS has hardcoded the broadcast address (how stupid is that?) and it is not possible to change the broadcast address ANYWHERE in the configuration in MS CM?
When our computers are sleeping they goto another VLAN. I could fix this whole issue with Wakeup in CM – if only Microsoft allowed me to change the broadcast address in the WoL-packet and use 255.255.255.255 instead.
Does anyone know if “Wakeup” from CM is hardcoded or if any script is used? If so, where can I edit the script?
Thanks!
/Chris
I have the same error:
“InvokeMethod” with “3” argument(s): “Generic failure ”
$return = $WMIConnection.psbase.InvokeMethod(“MachinesToWakeup”, $Par …
CategotyInfo : NotSpecified: (:) []. MethodInvocationException
any fix?
Adam:
The most common cause of that for me has been incorrectly formatted information in one of the parameters. AKA I use a hash table to convert the collection name to the collection number, so I don’t have to remember the collection code. If that doesn’t work and the collection name gets into the $Params.CollectionID parameter, it will throw that error. Or if the computer name, rather than the resource ID, is making it into the $Params.MachineIDs spot.