1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Wake on Lan code

Discussion in 'Internet, Connectivity and Communications' started by Apexes, Aug 6, 2015.

  1. Apexes

    Apexes Gigabyte Poster

    After something very specific, which is a bit out of my range.

    I'm configuring Wake on Lan for my sites via SCCM, here's a brief overview.

    Central Primary site hosted in data center, with clients communicating into that server from all different subnets and locations.

    Routers aren't configured for subnet broadcasts, so wake on lan via a packet this way is no use.

    I've managed to test it from Unicast from a client i have next to me, talking to my primary site in the datacenter, and all worked well.

    This is all well and good when running through SCCM, but what i'm after is some web gui that'd be able to do such a thing. I've done some googling without much luck. i can easily build a website GUI for this, but the real thing i need is the code that can run upon submitting the computer name, for it to generate a magic packet from the primary site to unicast it to the client.

    Any pointers, directions or advice appreciated!
    Certifications: 70-243 MCTS: ConfigMgr 2012 | MCSE: Private Cloud
  2. SimonD
    Honorary Member

    SimonD Terabyte Poster

    There used to be some SCCM 2007 tools that when installed could be used via the console to do exactly that.

    param (\\[String\\]$MACAddrString = $(throw 'No MAC addressed passed, please pass as xx:xx:xx:xx:xx:xx'))
    $MACAddr = $macAddrString.split(':') | %\\{ \\[byte\\]('0x' + $_) \\}
    if ($MACAddr.Length -ne 6)
    throw 'MAC address must be format xx:xx:xx:xx:xx:xx'
    $UDPclient = new-Object System.Net.Sockets.UdpClient
    $packet = \\[byte\\[\\]\\](,0xFF * 6)
    $packet += $MACAddr * 16
    \\[void\\] $UDPclient.Send($packet, $packet.Length)
    write "Wake-On-Lan magic packet sent to $MACAddrString, length $($packet.Length)"
    Failing that this PS script may work for you, I did a quick search and found it via google, it's not mine and I haven't tested it tho.
    Certifications: CNA | CNE | CCNA | MCP | MCP+I | MCSE NT4 | MCSA 2003 | Security+ | MCSA:S 2003 | MCSE:S 2003 | MCTS:SCCM 2007 | MCTS:Win 7 | MCITP:EDA7 | MCITP:SA | MCITP:EA | MCTS:Hyper-V | VCP 4 | ITIL v3 Foundation | VCP 5 DCV | VCP 5 Cloud | VCP6 NV | VCP6 DCV | VCAP 5.5 DCA
    WIP: VCP6-CMA, VCAP-DCD and Linux + (and possibly VCIX-NV).

Share This Page