From 048d85d12000eae13abdf9c69763f7c2e72ace73 Mon Sep 17 00:00:00 2001 From: Troy Harshberger Date: Thu, 22 Feb 2024 08:38:50 -0700 Subject: [PATCH] Update some logging verbosity, add some more logging --- Modules/CippExtensions/Autotask/New-AutotaskTicket.ps1 | 4 ++-- .../IronScales/Get-IronScalesIncidents.ps1 | 10 ++++------ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Modules/CippExtensions/Autotask/New-AutotaskTicket.ps1 b/Modules/CippExtensions/Autotask/New-AutotaskTicket.ps1 index 937be9122364..58c226174a74 100644 --- a/Modules/CippExtensions/Autotask/New-AutotaskTicket.ps1 +++ b/Modules/CippExtensions/Autotask/New-AutotaskTicket.ps1 @@ -3,7 +3,7 @@ function New-AutotaskTicket { param($atCompany, $title, $description, $estHr = 0.1) try{ - Get-AutotaskToken -configuration $Configuration.Autotask + Get-AutotaskToken -configuration $Configuration.Autotask | Out-Null $ticket = New-AutotaskBody -Resource Tickets -NoContent $ticket.Id = "0" #Always 0 for a new ticket @@ -25,7 +25,7 @@ function New-AutotaskTicket { New-AutotaskAPIResource -Resource Tickets -Body $ticket } catch { - Write-LogMessage -API 'Autotask' -tenant 'none' -message "Error creating ticket. $($_.Exception.Message)" -Sev Info + Write-LogMessage -API 'Autotask' -tenant 'none' -message "Error creating ticket. $($_.Exception.Message)" -Sev Error } } diff --git a/Modules/CippExtensions/IronScales/Get-IronScalesIncidents.ps1 b/Modules/CippExtensions/IronScales/Get-IronScalesIncidents.ps1 index d2b6d6e08f19..bdb2c6a07e23 100644 --- a/Modules/CippExtensions/IronScales/Get-IronScalesIncidents.ps1 +++ b/Modules/CippExtensions/IronScales/Get-IronScalesIncidents.ps1 @@ -47,6 +47,7 @@ function New-IronScalestickets { $managed_issues_body += Get-BodyForTicket $company } else { + Write-LogMessage -API 'IronScales' -tenant 'none' -message "Creating Autotask ticket for IronScales company $($company.customername)" -Sev Info $ATCompany = Get-AutotaskAPIResource -resource Companies -SimpleSearch "companyname beginswith $($company.Customername.Substring(0,4))" $tTitle = "[IronScales] New Incident(s) for $($company.CustomerName)" @@ -61,6 +62,7 @@ function New-IronScalestickets { } } if($managed_issues_body.Count -ne 0){ + Write-LogMessage -API 'IronScales' -tenant 'none' -message "Creating Autotask ticket for managed companies" -Sev Info $mTitle = "[IronScales-Managed] New Incident(s)" if(Get-ExistingTicket $mTitle){ continue } @@ -130,7 +132,7 @@ function Get-IronScalesIncidents { $all_unclassified = @() foreach($company in $SCRIPT:Companies){ try{ - Write-LogMessage -API "IronScales" -tenant "none" -message "Getting unclassified incidents for $($company.name):$($company.Id)" -sev Info + Write-LogMessage -API "IronScales" -tenant "none" -message "Getting unclassified incidents for $($company.name):$($company.Id)" -sev Debug $incidents = Get-Incidents $company.Id if($incidents.Length -gt 0){ @@ -147,7 +149,7 @@ function Get-IronScalesIncidents { } } - Write-LogMessage -API "IronScales" -tenant "none" -message "Got $($all_unclassified.Length) companies with unclassified incidents." -sev Info + Write-LogMessage -API "IronScales" -tenant "none" -message "Got $($all_unclassified.Length) companies with unclassified incidents." -sev Debug New-IronScalestickets $all_unclassified @@ -159,9 +161,6 @@ function Get-Companies { return } - #Write-Host "Getting Companies" - #Write-Host $SCRIPT:JWT - $reqargs = @{ Uri = "$($SCRIPT:apiHost+$is_endpoint.Companies+"list/")" Headers = @{ @@ -170,7 +169,6 @@ function Get-Companies { } $resp = Invoke-RestMethod @reqargs - #Write-Host $resp $SCRIPT:Companies = $resp.companies }