mirror of
https://github.com/snazy2000/SnipeitPS.git
synced 2025-12-13 01:42:29 +00:00
65 lines
1.8 KiB
PowerShell
65 lines
1.8 KiB
PowerShell
<#
|
|
.SYNOPSIS
|
|
Removes manufacturer from Snipe-it asset system
|
|
.DESCRIPTION
|
|
Removes manufacturer or multiple manufacturers from Snipe-it asset system
|
|
.PARAMETER ID
|
|
Unique ID For manufacturer to be removed
|
|
.PARAMETER url
|
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
|
|
|
.PARAMETER apiKey
|
|
Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit.
|
|
|
|
.EXAMPLE
|
|
Remove-SnipeitManufacturer -ID 44
|
|
|
|
.EXAMPLE
|
|
Get-SnipeitManufacturer | Where-object {$_.name -like '*something*'} | Remove-SnipeitManufacturer
|
|
#>
|
|
|
|
function Remove-SnipeitManufacturer () {
|
|
[CmdletBinding(
|
|
SupportsShouldProcess = $true,
|
|
ConfirmImpact = "Low"
|
|
)]
|
|
|
|
Param(
|
|
[parameter(mandatory = $true,ValueFromPipelineByPropertyName)]
|
|
[int[]]$id,
|
|
|
|
[parameter(mandatory = $false)]
|
|
[string]$url,
|
|
|
|
[parameter(mandatory = $false)]
|
|
[string]$apiKey
|
|
)
|
|
|
|
begin {
|
|
}
|
|
|
|
process {
|
|
foreach($manufacturer_id in $id) {
|
|
$Parameters = @{
|
|
Api = "/api/v1/manufacturers/$manufacturer_id"
|
|
Method = 'Delete'
|
|
}
|
|
|
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
|
Set-SnipeitPSSessionApiKey -apiKey $apikey
|
|
}
|
|
|
|
if ($PSBoundParameters.ContainsKey('url')) {
|
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
|
Set-SnipeitPSSessionApiKey -url $url
|
|
}
|
|
|
|
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
|
$result = Invoke-SnipeitMethod @Parameters
|
|
}
|
|
|
|
$result
|
|
}
|
|
}
|
|
}
|