Public/New-SnipeItManufacturer.ps1
<# .SYNOPSIS Add a new Manufacturer to Snipe-it asset system .DESCRIPTION Long description .PARAMETER Name Name of the Manufacturer .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 New-SnipeItManufacturer() { [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Low" )] Param( [parameter(mandatory = $true)] [string]$Name, [parameter(mandatory = $true)] [string]$url, [parameter(mandatory = $true)] [string]$apiKey ) Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name $Values = @{ "name" = $Name } #Convert Values to JSON format $Body = $Values | ConvertTo-Json; $Parameters = @{ Uri = "$url/api/v1/manufacturers" Method = 'post' Body = $Body Token = $apiKey } If ($PSCmdlet.ShouldProcess("ShouldProcess?")) { $result = Invoke-SnipeitMethod @Parameters } $result } |