mirror of
https://github.com/snazy2000/SnipeitPS.git
synced 2025-12-13 09:52:30 +00:00
Merge branch 'sheppyh-Feature/Remove-AssetMaintenance' into develop
This commit is contained in:
commit
b380e861c8
2 changed files with 54 additions and 1 deletions
52
SnipeitPS/Public/Remove-AssetMaintenance.ps1
Normal file
52
SnipeitPS/Public/Remove-AssetMaintenance.ps1
Normal 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
|
||||||
|
}
|
||||||
|
|
@ -106,7 +106,8 @@
|
||||||
'Add-Accessory',
|
'Add-Accessory',
|
||||||
'Set-Accessory',
|
'Set-Accessory',
|
||||||
'Get-Accessory',
|
'Get-Accessory',
|
||||||
'Remove-Asset'
|
'Remove-Asset',
|
||||||
|
'Remove-AssetMaintenance'
|
||||||
)
|
)
|
||||||
|
|
||||||
# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
|
# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue