SnipeitPS/SnipeitPS/Public/Remove-Asset.ps1

49 lines
909 B
PowerShell
Raw Normal View History

2020-01-23 11:08:42 -05:00
<#
.SYNOPSIS
Removes Asset to Snipe-it asset system
.DESCRIPTION
Long description
.PARAMETER ID
Unique ID For Asset to be removed
.EXAMPLE
Remove-Asset -ID 44 -url $url -apiKey $secret -Verbose
#>
function Remove-Asset ()
{
[CmdletBinding(
SupportsShouldProcess = $true,
ConfirmImpact = "Low"
)]
Param(
[parameter(mandatory = $true)]
[string]$ID,
[parameter(mandatory = $true)]
[string]$URL,
[parameter(mandatory = $true)]
[string]$APIKey
)
$Values = @{
"ID" = $Name
}
2020-01-23 11:18:34 -05:00
2020-01-23 11:14:36 -05:00
$Body = $Values | ConvertTo-Json
2020-01-23 11:08:42 -05:00
$Parameters = @{
Uri = "$url/api/v1/hardware/$ID"
Method = 'Delete'
Body = $Body
Token = $apiKey
}
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
{
$result = Invoke-SnipeitMethod @Parameters
}
$result
}