Added Remove-AssetMaintenance Function

This commit is contained in:
Harry John 2020-09-03 01:41:32 +01:00
parent 8214d8db99
commit fe5e3c6ba2
2 changed files with 52 additions and 0 deletions

View file

@ -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
}

Binary file not shown.