From 7cbcd575f63365f26286de811b9c440b9c031ebd Mon Sep 17 00:00:00 2001 From: MrCarter <36346842+MrCarter2959@users.noreply.github.com> Date: Thu, 23 Jan 2020 11:08:42 -0500 Subject: [PATCH] Create Remove-Asset.ps1 --- SnipeitPS/Public/Remove-Asset.ps1 | 49 +++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 SnipeitPS/Public/Remove-Asset.ps1 diff --git a/SnipeitPS/Public/Remove-Asset.ps1 b/SnipeitPS/Public/Remove-Asset.ps1 new file mode 100644 index 0000000..630ddfa --- /dev/null +++ b/SnipeitPS/Public/Remove-Asset.ps1 @@ -0,0 +1,49 @@ +<# + .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 + } + + $Body = $Values | ConvertTo-Json; + + $Parameters = @{ + Uri = "$url/api/v1/hardware/$ID" + Method = 'Delete' + Body = $Body + Token = $apiKey + } + + If ($PSCmdlet.ShouldProcess("ShouldProcess?")) + { + $result = Invoke-SnipeitMethod @Parameters + } + + $result +}