Compare commits
No commits in common. "7faa4d84c4adfb88b9bcd4764285e3844fcd4b18" and "98ab3f4f7e7ff1bd73d8220d76a8c9ebec585d67" have entirely different histories.
7faa4d84c4
...
98ab3f4f7e
13
.idea/.idea.ps-cmdlet-wol.dir/.idea/.gitignore
vendored
13
.idea/.idea.ps-cmdlet-wol.dir/.idea/.gitignore
vendored
@ -1,13 +0,0 @@
|
|||||||
# Default ignored files
|
|
||||||
/shelf/
|
|
||||||
/workspace.xml
|
|
||||||
# Rider ignored files
|
|
||||||
/.idea.ps-cmdlet-wol.iml
|
|
||||||
/modules.xml
|
|
||||||
/contentModel.xml
|
|
||||||
/projectSettingsUpdater.xml
|
|
||||||
# Datasource local storage ignored files
|
|
||||||
/dataSources/
|
|
||||||
/dataSources.local.xml
|
|
||||||
# Editor-based HTTP Client requests
|
|
||||||
/httpRequests/
|
|
@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="ProjectDictionaryState">
|
|
||||||
<dictionary name="asif" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
@ -1,8 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="UserContentModel">
|
|
||||||
<attachedFolders />
|
|
||||||
<explicitIncludes />
|
|
||||||
<explicitExcludes />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
@ -1,13 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="CommitMessageInspectionProfile">
|
|
||||||
<profile version="1.0">
|
|
||||||
<inspection_tool class="BodyLimit" enabled="true" level="ERROR" enabled_by_default="true" />
|
|
||||||
<inspection_tool class="SubjectBodySeparation" enabled="true" level="ERROR" enabled_by_default="true" />
|
|
||||||
<inspection_tool class="SubjectLimit" enabled="true" level="ERROR" enabled_by_default="true" />
|
|
||||||
</profile>
|
|
||||||
</component>
|
|
||||||
<component name="VcsDirectoryMappings">
|
|
||||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
@ -1,15 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<db>
|
|
||||||
<Configuration>
|
|
||||||
<AlwaysAuthorized>
|
|
||||||
"ITStaff",
|
|
||||||
"Administrators",
|
|
||||||
"Domain Admins"
|
|
||||||
</AlwaysAuthorized>
|
|
||||||
</Configuration>
|
|
||||||
<Computers>
|
|
||||||
<Computer name="Computer001" mac="AA:1A:2A:3A:4A:01" authorized="any"/>
|
|
||||||
<Computer name="Computer002" mac="BB:1B:2B:3B:4B:02" authorized="Managers"/>
|
|
||||||
<Computer name="Computer003" mac="CC:1C:2C:3C:4C:03" authorized="User3"/>
|
|
||||||
</Computers>
|
|
||||||
</db>
|
|
@ -1,79 +0,0 @@
|
|||||||
function Send-MagicPacket
|
|
||||||
{
|
|
||||||
[CmdletBinding()]
|
|
||||||
param
|
|
||||||
(
|
|
||||||
# Array of MAC addresses for which to construct magic packets
|
|
||||||
[Parameter(Mandatory, ValueFromPipeline, ValueFromPipelineByPropertyName)]
|
|
||||||
[ValidatePattern('^([0-9A-F]{2}[:-]){5}([0-9A-F]{2})$')]
|
|
||||||
[String[]]
|
|
||||||
$MacAddress,
|
|
||||||
|
|
||||||
# Broadcast IP address (default: all subnets --> 255.255.255.255)
|
|
||||||
[Parameter()]
|
|
||||||
[IPAddress]
|
|
||||||
$BroadcastIP = [System.Net.IPAddress]::Broadcast,
|
|
||||||
|
|
||||||
# UDP port over which to broadcast magic packet (default: 7)
|
|
||||||
[Parameter()]
|
|
||||||
[Int16]
|
|
||||||
$Port = 7
|
|
||||||
)
|
|
||||||
|
|
||||||
begin
|
|
||||||
{
|
|
||||||
# instantiate UDP client
|
|
||||||
try
|
|
||||||
{
|
|
||||||
$UdpClient = [System.Net.Sockets.UdpClient]::new()
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
Write-Error "Unable to instantiate UDP Client to send magic packets"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
process
|
|
||||||
{
|
|
||||||
foreach ($addr in $MacAddress)
|
|
||||||
{
|
|
||||||
# convert MAC address to magic packet
|
|
||||||
try
|
|
||||||
{
|
|
||||||
# construct byte-array from MAC address
|
|
||||||
$MAC = $addr -split '[:-]' | ForEach-Object {
|
|
||||||
[Byte]"0x$_"
|
|
||||||
}
|
|
||||||
|
|
||||||
# construct magic packet
|
|
||||||
# first 6 bytes = FF (255) then repeat MAC address 16 times
|
|
||||||
[Byte[]]$magicPacket = (,0xFF * 6) + ($MAC * 16)
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
Write-Warning "Unable to process MAC address: $thisMacAddress"
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
# broadcast magic packet
|
|
||||||
try
|
|
||||||
{
|
|
||||||
$UdpClient.Connect($BroadcastIP, $Port)
|
|
||||||
$UdpClient.Send($magicPacket, $magicPacket.Length) | Out-Null
|
|
||||||
Write-Verbose "Sent magic packet: Broadcast $addr over $BroadcastIP on port $Port (UDP)"
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
Write-Warning "Unable to send magic packet for '$addr'"
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
end
|
|
||||||
{
|
|
||||||
# dispose of UDP client
|
|
||||||
$UdpClient.Close()
|
|
||||||
$UdpClient.Dispose()
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user