From fe5e3c6ba2bd7ac4029348e0b4ebcec5e93d94e9 Mon Sep 17 00:00:00 2001 From: Harry John Date: Thu, 3 Sep 2020 01:41:32 +0100 Subject: [PATCH] Added Remove-AssetMaintenance Function --- SnipeitPS/Public/Remove-AssetMaintenance.ps1 | 52 +++++++++++++++++++ SnipeitPS/SnipeItPS.psd1 | Bin 9596 -> 9668 bytes 2 files changed, 52 insertions(+) create mode 100644 SnipeitPS/Public/Remove-AssetMaintenance.ps1 diff --git a/SnipeitPS/Public/Remove-AssetMaintenance.ps1 b/SnipeitPS/Public/Remove-AssetMaintenance.ps1 new file mode 100644 index 0000000..338bbe7 --- /dev/null +++ b/SnipeitPS/Public/Remove-AssetMaintenance.ps1 @@ -0,0 +1,52 @@ +function Remove-AssetMaintenance { + <# + .SYNOPSIS + Remove asset maintenance from Snipe-it asset system + .DESCRIPTION + Removes asset maintenance event from Snipe-it asset system by ID + .PARAMETER ID + Unique ID of the asset maintenance to be removed + .EXAMPLE + Remove-AssetMaintenance -ID 44 -url $url -apiKey $secret -Verbose + #> + [CmdletBinding( + SupportsShouldProcess = $true, + ConfirmImpact = "Low" + )] + param ( + # Asset maintenance ID + [Parameter(Mandatory = $true)] + [string] + $ID, + + # SnipeIt URL + [Parameter(Mandatory = $true)] + [string] + $url, + + # SnipeIt ApiKey + [Parameter(Mandatory = $true)] + [string] + $apiKey + ) + + $Values = @{ + "ID" = $ID + } + + $Body = $Values | ConvertTo-Json + + $Parameters = @{ + Uri = "$url/api/v1/maintenances/$ID" + Method = 'Delete' + Body = $Body + Token = $apiKey + } + + If ($PSCmdlet.ShouldProcess("ShouldProcess?")) + { + $result = Invoke-SnipeitMethod @Parameters + } + + $result +} diff --git a/SnipeitPS/SnipeItPS.psd1 b/SnipeitPS/SnipeItPS.psd1 index 780aa3c855eff24d20b6fc42db8090c49bb5cdd0..527c112a77d8afa8de1d056534d5e043d956f612 100644 GIT binary patch delta 32 ocmez4b;NsvnB?Sj5)#}&45