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 780aa3c..527c112 100644 Binary files a/SnipeitPS/SnipeItPS.psd1 and b/SnipeitPS/SnipeItPS.psd1 differ