mirror of
https://github.com/snazy2000/SnipeitPS.git
synced 2025-12-13 18:02:30 +00:00
Keep asset tag optional as in api+ more parameters
This commit is contained in:
parent
ddb0036156
commit
a4bc6bb3f0
1 changed files with 70 additions and 24 deletions
|
|
@ -5,17 +5,42 @@
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
Long description
|
Long description
|
||||||
|
|
||||||
.PARAMETER Tag
|
|
||||||
Asset Tag for the Asset
|
|
||||||
|
|
||||||
.PARAMETER Name
|
.PARAMETER status_id
|
||||||
Name of the Asset
|
Required Status ID of the asset, this can be got using Get-Status
|
||||||
|
|
||||||
.PARAMETER Status_id
|
.PARAMETER model_id
|
||||||
Status ID of the asset, this can be got using Get-Status
|
Required Model ID of the asset, this can be got using Get-Model
|
||||||
|
|
||||||
.PARAMETER Model_id
|
.PARAMETER name
|
||||||
Model ID of the asset, this can be got using Get-Model
|
Optional Name of the Asset
|
||||||
|
|
||||||
|
.PARAMETER asset_tag
|
||||||
|
Asset Tag for the Asset, not required when snipe asset_tag autogeneration is on.
|
||||||
|
|
||||||
|
.PARAMETER serial
|
||||||
|
Optional Serial number of the Asset
|
||||||
|
|
||||||
|
.PARAMETER company_id
|
||||||
|
Optional Company id
|
||||||
|
|
||||||
|
.PARAMETER order_number
|
||||||
|
Optional Order number
|
||||||
|
|
||||||
|
.PARAMETER notes
|
||||||
|
Optional Notes
|
||||||
|
|
||||||
|
.PARAMETER warranty_monhts
|
||||||
|
Optional Warranty lenght of the Asset in months
|
||||||
|
|
||||||
|
.PARAMETER purchase_cost
|
||||||
|
Optional Purchase cost of the Asset
|
||||||
|
|
||||||
|
.PARAMETER purchase_date
|
||||||
|
Optional Purchase cost of the Asset
|
||||||
|
|
||||||
|
.PARAMETER rtd_location_id
|
||||||
|
Optional Default location id for the asset
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-Info command
|
URL of Snipeit system, can be set using Set-Info command
|
||||||
|
|
@ -41,16 +66,45 @@ function New-Asset()
|
||||||
)]
|
)]
|
||||||
|
|
||||||
Param(
|
Param(
|
||||||
[string]$tag,
|
|
||||||
|
[parameter(mandatory = $true)]
|
||||||
|
[int]$status_id,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $true)]
|
||||||
[string]$Name,
|
[int]$model_id,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[int]$Status_id,
|
[string]$name,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[int]$Model_id,
|
[string]$asset_tag,
|
||||||
|
|
||||||
|
[parameter(mandatory = $false)]
|
||||||
|
[string]$serial,
|
||||||
|
|
||||||
|
[parameter(mandatory = $false)]
|
||||||
|
[int]$company_id,
|
||||||
|
|
||||||
|
[parameter(mandatory = $false)]
|
||||||
|
[string]$order_number,
|
||||||
|
|
||||||
|
[parameter(mandatory = $false)]
|
||||||
|
[string]$notes,
|
||||||
|
|
||||||
|
[parameter(mandatory = $false)]
|
||||||
|
[int]$warranty_months,
|
||||||
|
|
||||||
|
[parameter(mandatory = $false)]
|
||||||
|
[string]$purchase_cost,
|
||||||
|
|
||||||
|
[parameter(mandatory = $false)]
|
||||||
|
[string]$purchase_date,
|
||||||
|
|
||||||
|
[parameter(mandatory = $false)]
|
||||||
|
[int]$supplier_id,
|
||||||
|
|
||||||
|
[parameter(mandatory = $false)]
|
||||||
|
[int]$rtd_location_id,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $true)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
@ -61,16 +115,8 @@ function New-Asset()
|
||||||
[hashtable] $customfields
|
[hashtable] $customfields
|
||||||
)
|
)
|
||||||
|
|
||||||
$Values = @{
|
$Values = . Get-ParameterValue $MyInvocation.MyCommand.Parameters
|
||||||
"name" = $Name
|
|
||||||
"status_id" = $status_id
|
|
||||||
"model_id" = $model_id
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($PSBoundParameters.ContainsKey('tag'))
|
|
||||||
{
|
|
||||||
$Values += @{"asset_tag" = $tag}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($customfields)
|
if ($customfields)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue