From 228da72361219b065e6b7f14e366e67aa61a164c Mon Sep 17 00:00:00 2001 From: jayrodksmith <51105538+jayrodksmith@users.noreply.github.com> Date: Thu, 21 Mar 2024 13:08:46 +0800 Subject: [PATCH] Added check for Ninja fields --- Private/RMM/Get-WarrantyNinjaRMM.ps1 | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/Private/RMM/Get-WarrantyNinjaRMM.ps1 b/Private/RMM/Get-WarrantyNinjaRMM.ps1 index 90f9edf..db0fe09 100644 --- a/Private/RMM/Get-WarrantyNinjaRMM.ps1 +++ b/Private/RMM/Get-WarrantyNinjaRMM.ps1 @@ -18,7 +18,27 @@ function Get-WarrantyNinjaRMM { [Parameter(Mandatory = $false)] [Switch]$Display ) - + # Test if fields exist + $testninjawarrantystart = Ninja-Property-Get $ninjawarrantystart 2>&1 + if ($testninjawarrantystart -match "Unable to find the specified field" ){ + Write-Host "Unable to access warrantystart field in ninja" + Write-Host "Check permissions of field and that it exists" + } + $testninjawarrantystatus = Ninja-Property-Get $ninjawarrantystatus 2>&1 + if ($testninjawarrantystatus -match "Unable to find the specified field" ){ + Write-Host "Unable to access warrantystatus field in ninja" + Write-Host "Check permissions of field and that it exists" + } + $testninjawarrantyexpiry = Ninja-Property-Get $ninjawarrantyexpiry 2>&1 + if ($testninjawarrantyexpiry -match "Unable to find the specified field" ){ + Write-Host "Unable to access warrantyexpiry field in ninja" + Write-Host "Check permissions of field and that it exists" + } + $testninjainvoicenumber = Ninja-Property-Get $ninjainvoicenumber 2>&1 + if ($testninjainvoicenumber -match "Unable to find the specified field" ){ + Write-Host "Unable to access invoicenumber field in ninja" + Write-Host "Check permissions of field and that it exists" + } $ninjawarrantystartvalue = Ninja-Property-Get $ninjawarrantystart $ninjawarrantystatusvalue = Ninja-Property-Get $ninjawarrantystatus $ninjawarrantyexpiryvalue = Ninja-Property-Get $ninjawarrantyexpiry