Share via

Remote turn on Computer

mby 106 Reputation points
2020-11-18T10:53:35.483+00:00

Hello,

Can not remember from which site I took the following code:

*$Mac=""
$MacByteArray = $Mac -split "[:-]" | ForEach-Object { [Byte] "0x$_"}
[Byte[]] $MagicPacket = (,0xFF * 6) + ($MacByteArray * 16)
$UdpClient = New-Object System.Net.Sockets.UdpClient
$UdpClient.Connect(([System.Net.IPAddress]::Broadcast),7)
$UdpClient.Send($MagicPacket,$MagicPacket.Length)
$UdpClient.Close()*

The code works fine from my computer and not from the server.
Do you have an idea, why

Thanks in advance

Windows for business | Windows Client for IT Pros | User experience | Remote desktop services and terminal services

2 answers

Sort by: Most helpful
  1. mby 106 Reputation points
    2020-11-19T05:47:41.993+00:00

    no error receive. the server and the computer in the same network. the computer, i try boot is on the same network.

    Was this answer helpful?

    0 comments No comments

  2. FJcmdk4488 56 Reputation points
    2020-11-18T19:46:05.207+00:00

    There are a lot of details missing in order to figure out why this script is not working. i.e. what error are you receiving? Are the server and computer located in the same network? Where is the computer you are trying to remote boot in relation to where you are running this code?

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.