1

Regardless of what Script I use I can not get PowerShell 5.1 to trigger a boot on my Hyper-V Host.

I can use the solarwinds WakeonLan tool to boot the server, but I would like to find a solution that would work natively.

I tried many scripts I had found online and as a last ditch effort, I installed the "WakeOnLAN 1.0" Module but while it says it executes successfully the server does not boot

PS C:\WINDOWS\system32> Invoke-WakeOnLan 52:a4:4c:52:d7:52 -Verbose
VERBOSE: Wake-on-Lan Packet sent to 52:a4:4c:52:d7:52

What could cause the server only to boot with the SolarWinds WakeOnLan.exe but not natively in Powershell?

As it may be relevant the computer I am attempting to send the MagicPacket from is a MultiNic Machine but only 1 NIC is IP'd on the subnet of the Hyper-V server.

Other Scripts I attempted to use:

V Britt
  • 25
  • 1
  • 7
  • 1
    Did you try quoting the MAC address? – Theo Mar 21 '21 at 19:59
  • Are you using Windows PowerShell (up to version 5.1) or PowerShell (Core) (v6+)? – mklement0 Mar 21 '21 at 20:18
  • 2
    @zett42, the code uses `.Split('-:')`, which works like `.Split([char[]] '-:')` (as intended) in WinPS, but like `.Split([string]'-:')` in PS Core - see the bottom section of [this answer](https://stackoverflow.com/a/41905031/45375) – mklement0 Mar 21 '21 at 21:06
  • Yes I tried both single and double quotes as well as : and - separators. PS C:\WINDOWS\system32> $PSVersionTable Name Value ---- ----- PSVersion 5.1.19041.610 PSEdition Desktop PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...} BuildVersion 10.0.19041.610 CLRVersion 4.0.30319.42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1 – V Britt Mar 22 '21 at 02:12
  • Usually wake on lan only works on the same subnet. – js2010 Sep 01 '22 at 17:00

1 Answers1

0

Something like this works for me with remote powershell, going to the same subnet the down computers are on. Fast startup also has to be disabled in the windows 10 registry (HiberbootEnabled=0).

$mac = @{comp002 = '00:11:22:33:44:55'; comp003 = '00:11:22:33:44:56'}
$compsDown = 'comp002','comp003'
# (,) is silly workaround to pass array as invoke-command arguments
icm comp001 invoke-wakeonlan.ps1 -args (,$mac[$compsDown])
js2010
  • 23,033
  • 6
  • 64
  • 66