$WorkstatList=Import-Csv workstation.csv # workstations.csv file with 2 columns : computername,macadd $computer=read-host "Enter Workstation to wake..." Try { function WakeOnLan($computer) { $WoL = $WorkstatList |where-object {$_.computername -eq $computer} |Select-Object macadd else { $Wol.macadd -match "(..)(..)(..)(..)(..)(..)" | out-null $macadd = [byte[]]($matches[1..6] |% {[int]"0x$_"}) $UDPclient = new-Object System.Net.Sockets.UdpClient $UDPclient.Connect(([System.Net.IPAddress]::Broadcast),4000) $packet = [byte[]](,0xFF * 102) 6..101 |% { $packet[$_] = $macadd[($_%6)]} $UDPclient.Send($packet, $packet.Length) ping -4 -n 10 $computer # you can change packets count Write-Host "Workstation $computer is Booting Up..." } } WakeOnLan($computer) sleep(7) } catch {Write-Host "Workstation is Not Found ! Or ! MacAddres is Not Correct in workstation.csv !" -ForegroundColor Red sleep(5) }