optional input was defaulting to blank string, so checking against null

was not working, fixed.
This commit is contained in:
2023-09-21 17:42:30 -04:00
parent 3863f0772e
commit c54a2a928e
+4 -4
View File
@@ -59,8 +59,8 @@ param(
[string] $token = $(throw "-token is required"),
[string] $netmask = "128",
[string] $logfile = "$env:USERPROFILE\\.dynv6.log",
[string] $ipv4 = $null,
[string] $ipv6 = $null
[string] $ipv4 = "",
[string] $ipv6 = ""
)
# we store ip addresses in files, so we only update when there is a change
@@ -88,12 +88,12 @@ $update6 = [System.Uri]'https://dynv6.com/api/update'
Get-Date | Tee-Object -FilePath $logfile -Append | Out-Host
# lookup IPv4, will be skipped if variable already set
if ($ipv4 -eq $null) {
if ($ipv4 -eq "") {
$ipv4 = Invoke-RestMethod -Method Get -Uri $lookup4
}
# lookup IPv6, will be skipped if variable already set
if ($ipv6 -eq $null) {
if ($ipv6 -eq "") {
$ipv6 = Invoke-RestMethod -Method Get -Uri $lookup6
}