From 492906f598dd9755172fe6c3aeb5bf422ad45a18 Mon Sep 17 00:00:00 2001 From: Brad Parker Date: Wed, 22 Oct 2025 19:16:50 -0500 Subject: [PATCH 1/2] Improves Verkada module connection and event handling Updates the Connect-Verkada function to capture the response code during the API token retrieval process for better error handling and permissions considerations on the key being used. Corrects an issue in Set-VerkadaHelixEvent where the function was attempting to return the string "Event updated successfully" twice, now only returns it once. --- verkadaModule/Public/Connect-Verkada.ps1 | 4 ++-- verkadaModule/Public/Set-VerkadaHelixEvent.ps1 | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/verkadaModule/Public/Connect-Verkada.ps1 b/verkadaModule/Public/Connect-Verkada.ps1 index 54fefb9..db4bea8 100644 --- a/verkadaModule/Public/Connect-Verkada.ps1 +++ b/verkadaModule/Public/Connect-Verkada.ps1 @@ -108,7 +108,7 @@ function Connect-Verkada 'x-api-key' = $Global:verkadaConnection.x_api_key } - $x_verkada_auth_api = Invoke-RestMethod -Uri "https://$($region).verkada.com/token" -Method 'POST' -Headers $login_headers | Select-Object -ExpandProperty token + $x_verkada_auth_api = Invoke-RestMethod -Uri "https://$($region).verkada.com/token" -Method 'POST' -Headers $login_headers -StatusCodeVariable responseCode | Select-Object -ExpandProperty token $Global:verkadaConnection.x_verkada_auth_api = $x_verkada_auth_api $body = @{ @@ -119,7 +119,7 @@ function Connect-Verkada 'x-verkada-auth' = $Global:verkadaConnection.x_verkada_auth_api } - $response = Invoke-RestMethod -Uri "https://$($region).verkada.com/core/v1/audit_log" -Body $body -Headers $headers -StatusCodeVariable responseCode + #$response = Invoke-RestMethod -Uri "https://$($region).verkada.com/core/v1/audit_log" -Body $body -Headers $headers -StatusCodeVariable responseCode if (!($noOutput)){Write-Host -ForegroundColor green "$responseCode - Successfully connected to Verkada Command with API Token"} return } catch [Microsoft.PowerShell.Commands.HttpResponseException] { diff --git a/verkadaModule/Public/Set-VerkadaHelixEvent.ps1 b/verkadaModule/Public/Set-VerkadaHelixEvent.ps1 index c59fc6a..6d081d7 100644 --- a/verkadaModule/Public/Set-VerkadaHelixEvent.ps1 +++ b/verkadaModule/Public/Set-VerkadaHelixEvent.ps1 @@ -89,7 +89,7 @@ function Set-VerkadaHelixEvent{ try { Invoke-VerkadaRestMethod $url $org_id $x_verkada_auth_api $query_params -body_params $body_params -method PATCH - return return "Event updated successfully" + return "Event updated successfully" } catch [Microsoft.PowerShell.Commands.HttpResponseException] { $err = $_.ErrorDetails | ConvertFrom-Json From c77f60b8febffac8e280beca33f49c0ea963ff39 Mon Sep 17 00:00:00 2001 From: bepsoccer <26012546+bepsoccer@users.noreply.github.com> Date: Thu, 23 Oct 2025 00:18:29 +0000 Subject: [PATCH 2/2] Bumping release to 0.9.10 --- verkadaModule/verkadaModule.psd1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/verkadaModule/verkadaModule.psd1 b/verkadaModule/verkadaModule.psd1 index 73c1396..e161424 100644 --- a/verkadaModule/verkadaModule.psd1 +++ b/verkadaModule/verkadaModule.psd1 @@ -3,7 +3,7 @@ # # Generated by: Verkada SE Community # -# Generated on: 10/21/2025 +# Generated on: 10/23/2025 # @{ @@ -12,7 +12,7 @@ RootModule = 'verkadaModule.psm1' # Version number of this module. -ModuleVersion = '0.9.9' +ModuleVersion = '0.9.10' # Supported PSEditions CompatiblePSEditions = 'Desktop', 'Core'