Add datatype to param()

This commit is contained in:
Markus Fleschutz
2021-07-15 15:51:22 +02:00
parent 35255539df
commit b97098fc42
109 changed files with 256 additions and 216 deletions

View File

@ -11,9 +11,7 @@
Author: Markus Fleschutz / License: CC0
#>
param($MACaddress = "", $IPaddress = "", [int]$Port=9)
if ($MACaddress -eq "" ) { $MACaddress = read-host "Enter the MAC address (e.g. 00:11:22:33:44:55)" }
if ($IPaddress -eq "" ) { $IPaddress = read-host "Enter the IP address or subnet address (e.g. 255.255.255.255)" }
param([string]$MACaddress = "", [string]$IPaddress = "", [int]$Port=9)
function Send-WOL { param([string]$mac, [string]$ip="255.255.255.255", [int]$port=9)
$broadcast = [Net.IPAddress]::Parse($ip)
@ -28,6 +26,9 @@ function Send-WOL { param([string]$mac, [string]$ip="255.255.255.255", [int]$por
}
try {
if ($MACaddress -eq "" ) { $MACaddress = read-host "Enter the MAC address (e.g. 00:11:22:33:44:55)" }
if ($IPaddress -eq "" ) { $IPaddress = read-host "Enter the IP address or subnet address (e.g. 255.255.255.255)" }
Send-WOL $MACaddress $IPaddress $Port
start-sleep -milliseconds 100
Send-WOL $MACaddress $IPaddress $Port