From 00ec0cfd54336b68d9e5ba3ac757032ca1e5ee22 Mon Sep 17 00:00:00 2001 From: "cole@cybertek.systems" Date: Wed, 25 Dec 2024 09:46:50 -0600 Subject: [PATCH] name change --- wificonnectionbackup.ps1 => wificonnectionbackup_v1.ps1 | 0 wificonnectionbackup_v3.ps1 | 8 ++++++-- 2 files changed, 6 insertions(+), 2 deletions(-) rename wificonnectionbackup.ps1 => wificonnectionbackup_v1.ps1 (100%) diff --git a/wificonnectionbackup.ps1 b/wificonnectionbackup_v1.ps1 similarity index 100% rename from wificonnectionbackup.ps1 rename to wificonnectionbackup_v1.ps1 diff --git a/wificonnectionbackup_v3.ps1 b/wificonnectionbackup_v3.ps1 index 00022a5..f388a2f 100644 --- a/wificonnectionbackup_v3.ps1 +++ b/wificonnectionbackup_v3.ps1 @@ -23,10 +23,14 @@ foreach ($profile in $wifiProfiles) { # Send data to the API try { - $response = Invoke-WebRequest -Uri $apiEndpoint -Method Post -Body ($payload | ConvertTo-Json -Depth 10) -Headers $headers + $response = Invoke-WebRequest -Uri $apiEndpoint -Method Post -Body ($payload | ConvertTo-Json -Depth 10) -Headers $headers -UseBasicParsing Write-Output "Success: SSID '$profile' added. Message: $($response.Content)" } catch { - Write-Output "Error: Could not add SSID '$profile'. Error: $($_.Exception.Message)" + if ($_.Exception.Response.StatusCode -eq 409) { + Write-Output "Conflict: SSID '$profile' already exists or conflicts with server rules." + } else { + Write-Output "Error: Could not add SSID '$profile'. Error: $($_.Exception.Message)" + } } } }