Difference between revisions of "Power Shell"

Jump to navigation Jump to search
(→‎Execution Policy: Added Bypass)
(→‎Network: Added WoL Script)
Line 281: Line 281:
IPAddressToString : 159.104.31.83
IPAddressToString : 159.104.31.83
</pre>
</pre>
=== WoL Script ===
This script was sourced from http://thepowershellguy.com/blogs/posh/archive/2007/04/01/powershell-wake-on-lan-script.aspx
<source lang="powershell">
script-file version
param ([String]$macString = $(throw 'mac address is required'))
$mac = $macString.split(':') | %{ [byte]('0x' + $_) }
if ($mac.Length -ne 6)
{
  throw 'mac address must be 6 hex numbers separated by :'
}
$UDPclient = new-Object System.Net.Sockets.UdpClient
$UDPclient.Connect(([System.Net.IPAddress]::Broadcast),4000)
$packet = [byte[]](,0xFF * 6)
$packet += $mac * 16
write-debug ([bitconverter]::tostring($packet))
[void] $UDPclient.Send($packet, $packet.Length)
write-debug "Wake-On-Lan magic packet of length $($packet.Length) sent to $macString"
</source>


== FTP ==
== FTP ==