mirror of
https://github.com/snazy2000/SnipeitPS.git
synced 2025-12-13 18:02:30 +00:00
Merge pull request #196 from PetriAsi/feature/manufacturers
Feature/manufacturers
This commit is contained in:
commit
9f84595e36
3 changed files with 80 additions and 1 deletions
|
|
@ -39,7 +39,7 @@ function Remove-SnipeitManufacturer ()
|
||||||
process {
|
process {
|
||||||
foreach($manufacturer_id in $id){
|
foreach($manufacturer_id in $id){
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/manufacturers/$manufacturer_id_id"
|
Uri = "$url/api/v1/manufacturers/$manufacturer_id"
|
||||||
Method = 'Delete'
|
Method = 'Delete'
|
||||||
Token = $apiKey
|
Token = $apiKey
|
||||||
}
|
}
|
||||||
|
|
|
||||||
78
SnipeitPS/Public/Set-SnipeitManufacturer.ps1
Normal file
78
SnipeitPS/Public/Set-SnipeitManufacturer.ps1
Normal file
|
|
@ -0,0 +1,78 @@
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Add a new Manufacturer to Snipe-it asset system
|
||||||
|
|
||||||
|
.DESCRIPTION
|
||||||
|
Long description
|
||||||
|
|
||||||
|
.PARAMETER Name
|
||||||
|
Name of the Manufacturer
|
||||||
|
|
||||||
|
.PARAMETER image
|
||||||
|
Image file name and path for item
|
||||||
|
|
||||||
|
.PARAMETER image_delete
|
||||||
|
Remove current image
|
||||||
|
|
||||||
|
.PARAMETER RequestType
|
||||||
|
Http request type to send Snipe IT system. Defaults to Patch you could use Put if needed.
|
||||||
|
|
||||||
|
.PARAMETER url
|
||||||
|
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
||||||
|
|
||||||
|
.PARAMETER apiKey
|
||||||
|
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
New-SnipeitManufacturer -name "HP"
|
||||||
|
#>
|
||||||
|
|
||||||
|
function Set-SnipeitManufacturer()
|
||||||
|
{
|
||||||
|
[CmdletBinding(
|
||||||
|
SupportsShouldProcess = $true,
|
||||||
|
ConfirmImpact = "Low"
|
||||||
|
)]
|
||||||
|
|
||||||
|
Param(
|
||||||
|
[parameter(mandatory = $true)]
|
||||||
|
[string]$Name,
|
||||||
|
|
||||||
|
[ValidateScript({Test-Path $_})]
|
||||||
|
[string]$image,
|
||||||
|
|
||||||
|
[switch]$image_delete=$false,
|
||||||
|
|
||||||
|
[ValidateSet("Put","Patch")]
|
||||||
|
[string]$RequestType = "Patch",
|
||||||
|
|
||||||
|
[parameter(mandatory = $true)]
|
||||||
|
[string]$url,
|
||||||
|
|
||||||
|
[parameter(mandatory = $true)]
|
||||||
|
[string]$apiKey
|
||||||
|
)
|
||||||
|
|
||||||
|
begin{
|
||||||
|
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
||||||
|
|
||||||
|
$Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
|
||||||
|
}
|
||||||
|
|
||||||
|
process{
|
||||||
|
foreach ($manufacturer_id in $id) {
|
||||||
|
$Parameters = @{
|
||||||
|
Uri = "$url/api/v1/manufacturers/$manufacturer_id"
|
||||||
|
Method = $RequestType
|
||||||
|
Body = $Values
|
||||||
|
Token = $apiKey
|
||||||
|
}
|
||||||
|
|
||||||
|
If ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
||||||
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
|
}
|
||||||
|
|
||||||
|
$result
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -135,6 +135,7 @@ FunctionsToExport = @(
|
||||||
'Set-SnipeitLicense',
|
'Set-SnipeitLicense',
|
||||||
'Set-SnipeitLicenseSeat',
|
'Set-SnipeitLicenseSeat',
|
||||||
'Set-SnipeitLocation',
|
'Set-SnipeitLocation',
|
||||||
|
'Set-SnipeitManufacturer',
|
||||||
'Set-SnipeitModel',
|
'Set-SnipeitModel',
|
||||||
'Set-SnipeitStatus',
|
'Set-SnipeitStatus',
|
||||||
'Set-SnipeitUser',
|
'Set-SnipeitUser',
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue