From 68ae03901301f6a61df2043fe7cd9bbaed82bee6 Mon Sep 17 00:00:00 2001 From: RussellLeVasseur <58618324+RussellLeVasseur@users.noreply.github.com> Date: Thu, 27 Jan 2022 09:39:08 -0500 Subject: [PATCH 1/5] Add Next Audit Date to New-SnipeItAudit.ps1 --- SnipeitPS/Public/New-SnipeitAudit.ps1 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/SnipeitPS/Public/New-SnipeitAudit.ps1 b/SnipeitPS/Public/New-SnipeitAudit.ps1 index 671374a..5996945 100644 --- a/SnipeitPS/Public/New-SnipeitAudit.ps1 +++ b/SnipeitPS/Public/New-SnipeitAudit.ps1 @@ -28,6 +28,9 @@ function New-SnipeitAudit() { [int]$location_id, + [parameter(mandatory = $false)] + [string]$nextAudit, + [parameter(mandatory = $false)] [string]$url, @@ -45,6 +48,10 @@ function New-SnipeitAudit() { if ($PSBoundParameters.ContainsKey('tag')) { $Values += @{"asset_tag" = $tag} } + + if ($PSBoundParameters.ContainsKey('nextAudit')) { + $Values += @{"next_audit_date" = $nextAudit} + } $Parameters = @{ Api = "/api/v1/hardware/audit" From 51cb9f88f5f9db2243afdcc376d511943bea4af4 Mon Sep 17 00:00:00 2001 From: RussellLeVasseur <58618324+RussellLeVasseur@users.noreply.github.com> Date: Thu, 27 Jan 2022 09:45:15 -0500 Subject: [PATCH 2/5] Update New-SnipeitAudit.ps1 - Modified nextAudit param to [datetime] - Added parameter description at beginning of doc - Added code to format date to yyyy-MM-dd for SnipeIT --- SnipeitPS/Public/New-SnipeitAudit.ps1 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/SnipeitPS/Public/New-SnipeitAudit.ps1 b/SnipeitPS/Public/New-SnipeitAudit.ps1 index 5996945..cbe4117 100644 --- a/SnipeitPS/Public/New-SnipeitAudit.ps1 +++ b/SnipeitPS/Public/New-SnipeitAudit.ps1 @@ -8,6 +8,9 @@ Long description .PARAMETER Tag The asset tag of the asset you wish to audit +.PARAMETER purchase_date +Due date for the asset's next audit + .PARAMETER Location_id ID of the location you want to associate with the audit @@ -29,7 +32,7 @@ function New-SnipeitAudit() { [int]$location_id, [parameter(mandatory = $false)] - [string]$nextAudit, + [datetime]$nextAudit, [parameter(mandatory = $false)] [string]$url, @@ -50,7 +53,7 @@ function New-SnipeitAudit() { } if ($PSBoundParameters.ContainsKey('nextAudit')) { - $Values += @{"next_audit_date" = $nextAudit} + $Values += @{"next_audit_date" = ($nextAudit).ToString("yyyy-MM-dd")} } $Parameters = @{ From f26db93a1655b901d971735954f2c8b31c736811 Mon Sep 17 00:00:00 2001 From: RussellLeVasseur <58618324+RussellLeVasseur@users.noreply.github.com> Date: Thu, 27 Jan 2022 09:49:22 -0500 Subject: [PATCH 3/5] Fix variable naming and one grammar error Changed from nextAudit to next_audit. --- SnipeitPS/Public/New-SnipeitAudit.ps1 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/SnipeitPS/Public/New-SnipeitAudit.ps1 b/SnipeitPS/Public/New-SnipeitAudit.ps1 index cbe4117..809ab9c 100644 --- a/SnipeitPS/Public/New-SnipeitAudit.ps1 +++ b/SnipeitPS/Public/New-SnipeitAudit.ps1 @@ -8,7 +8,7 @@ Long description .PARAMETER Tag The asset tag of the asset you wish to audit -.PARAMETER purchase_date +.PARAMETER Next_audit Due date for the asset's next audit .PARAMETER Location_id @@ -32,7 +32,7 @@ function New-SnipeitAudit() { [int]$location_id, [parameter(mandatory = $false)] - [datetime]$nextAudit, + [datetime]$next_audit, [parameter(mandatory = $false)] [string]$url, @@ -52,8 +52,8 @@ function New-SnipeitAudit() { $Values += @{"asset_tag" = $tag} } - if ($PSBoundParameters.ContainsKey('nextAudit')) { - $Values += @{"next_audit_date" = ($nextAudit).ToString("yyyy-MM-dd")} + if ($PSBoundParameters.ContainsKey('next_audit')) { + $Values += @{"next_audit_date" = ($next_audit).ToString("yyyy-MM-dd")} } $Parameters = @{ From b4c2b51024ac1223a17dd599c3c277757572c488 Mon Sep 17 00:00:00 2001 From: Russell LeVasseur <58618324+RussellLeVasseur@users.noreply.github.com> Date: Fri, 4 Feb 2022 09:39:58 -0500 Subject: [PATCH 4/5] changed var to next_audit_date --- SnipeitPS/Public/New-SnipeitAudit.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/SnipeitPS/Public/New-SnipeitAudit.ps1 b/SnipeitPS/Public/New-SnipeitAudit.ps1 index 809ab9c..0a2911e 100644 --- a/SnipeitPS/Public/New-SnipeitAudit.ps1 +++ b/SnipeitPS/Public/New-SnipeitAudit.ps1 @@ -8,7 +8,7 @@ Long description .PARAMETER Tag The asset tag of the asset you wish to audit -.PARAMETER Next_audit +.PARAMETER next_audit_date Due date for the asset's next audit .PARAMETER Location_id @@ -32,7 +32,7 @@ function New-SnipeitAudit() { [int]$location_id, [parameter(mandatory = $false)] - [datetime]$next_audit, + [datetime]$next_audit_date, [parameter(mandatory = $false)] [string]$url, @@ -52,7 +52,7 @@ function New-SnipeitAudit() { $Values += @{"asset_tag" = $tag} } - if ($PSBoundParameters.ContainsKey('next_audit')) { + if ($PSBoundParameters.ContainsKey('next_audit_date')) { $Values += @{"next_audit_date" = ($next_audit).ToString("yyyy-MM-dd")} } From e321cd3fa1ed2f2020f0df19d8821f30d48b1314 Mon Sep 17 00:00:00 2001 From: Petri Asikainen Date: Sat, 5 Feb 2022 13:17:19 +0200 Subject: [PATCH 5/5] corrected missed next_audit_date --- SnipeitPS/Public/New-SnipeitAudit.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SnipeitPS/Public/New-SnipeitAudit.ps1 b/SnipeitPS/Public/New-SnipeitAudit.ps1 index 0a2911e..60d4a7e 100644 --- a/SnipeitPS/Public/New-SnipeitAudit.ps1 +++ b/SnipeitPS/Public/New-SnipeitAudit.ps1 @@ -53,7 +53,7 @@ function New-SnipeitAudit() { } if ($PSBoundParameters.ContainsKey('next_audit_date')) { - $Values += @{"next_audit_date" = ($next_audit).ToString("yyyy-MM-dd")} + $Values += @{"next_audit_date" = ($next_audit_date).ToString("yyyy-MM-dd")} } $Parameters = @{