Following on from this post:<\/p>\n
WOL solutions with powershell batch task scheduler<\/a><\/p>\n
Below is the code that is working great and speeds our time up no end! However, one thing we have noticed is that some PC’s are not turning on. The BIOS and the network card have been set up for WOL and have been working. We then found out this may be due to the power plug not plugged in or the network cable is unplugged which is an easy fix. So our question is, we would like to know is it possible for the PowerShell below to output a txt file with any PC’s that it failed against as it can’t send the magic packet to wake the PC up? (Or it basically cant communicate with the client) It would be great if this could show the Computer Name and/or MAC address is this txt file?<\/p>\n Many thanks.<\/p>\n Function Wake-Computer { #checks<\/span> the syntax of MAC address #build<\/span> magic package Wake-on-LAN - Wikipedia<\/a> $packet = [byte<\/span>](,0xFF * 102)<\/p>\n
\nparam(
\n[string]$mac
\n)<\/p>\n
\nif (!(($mac -like “:<\/em>::<\/em>::<\/em>”) -or ($mac -like “-<\/em>--<\/em>--<\/em>”))){
\nwrite-error “mac address not in correct format”
\nbreak
\n}<\/p>\n
\n$string=@($mac.split(“:”“-”) | foreach {$_.insert(0,“0x”)})
\n$target = [byte<\/span>]($string[0], $string[1], $string[2], $string[3], $string[4], $string[5])<\/p>\n<\/a>The magic packet is a broadcast frame containing anywhere within its payload 6 bytes of all 255 (FF FF FF FF FF FF in hexadecimal)<\/h1>\n
<\/a>followed by sixteen repetitions of the target computer’s 48-bit MAC address, for a total of 102 bytes.<\/h1>\n