mirror of
https://github.com/snazy2000/SnipeitPS.git
synced 2025-12-13 18:02:30 +00:00
Updated for current API fields
The API supports a 'PUT' for modifying parts of an asset, but most of the supported fields were missing (I need to be able to set a location for example which was missing). I've added all the current API fields and replaced the $values section with Get-ParameterValue. Not fully tested everything but looking good so far.
This commit is contained in:
parent
8214d8db99
commit
63f6ae12e2
1 changed files with 58 additions and 7 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Update a Asset in the Snipe-it asset system
|
Update a specific Asset in the Snipe-it asset system
|
||||||
|
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
Long description
|
Long description
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
ID of the Asset
|
ID of the Asset
|
||||||
|
|
||||||
.PARAMETER Name
|
.PARAMETER Name
|
||||||
Name of the Asset
|
Asset name
|
||||||
|
|
||||||
.PARAMETER Status_id
|
.PARAMETER Status_id
|
||||||
Status ID of the asset, this can be got using Get-Status
|
Status ID of the asset, this can be got using Get-Status
|
||||||
|
|
@ -17,6 +17,39 @@
|
||||||
.PARAMETER Model_id
|
.PARAMETER Model_id
|
||||||
Model ID of the asset, this can be got using Get-Model
|
Model ID of the asset, this can be got using Get-Model
|
||||||
|
|
||||||
|
.PARAMETER last_checkout
|
||||||
|
Date the asset was last checked out
|
||||||
|
|
||||||
|
.PARAMETER assigned_to
|
||||||
|
The id of the user the asset is currently checked out to
|
||||||
|
|
||||||
|
.PARAMETER company_id
|
||||||
|
The id of an associated company id
|
||||||
|
|
||||||
|
.PARAMETER serial
|
||||||
|
Serial number of the asset
|
||||||
|
|
||||||
|
.PARAMETER order_number
|
||||||
|
Order number for the asset
|
||||||
|
|
||||||
|
.PARAMETER warranty_months
|
||||||
|
Number of months for the asset warranty
|
||||||
|
|
||||||
|
.PARAMETER purchase_cost
|
||||||
|
Purchase cost of the asset, without a currency symbol
|
||||||
|
|
||||||
|
.PARAMETER purchase_date
|
||||||
|
Date of asset purchase
|
||||||
|
|
||||||
|
.PARAMETER requestable
|
||||||
|
Whether or not the asset can be requested by users with the permission to request assets
|
||||||
|
|
||||||
|
.PARAMETER archived
|
||||||
|
Whether or not the asset is archived. Archived assets cannot be checked out and do not show up in the deployable asset screens
|
||||||
|
|
||||||
|
.PARAMETER rtd_location_id
|
||||||
|
The id that corresponds to the location where the asset is usually located when not checked out
|
||||||
|
|
||||||
.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
|
||||||
|
|
||||||
|
|
@ -50,6 +83,28 @@ function Set-Asset()
|
||||||
|
|
||||||
[string]$Model_id,
|
[string]$Model_id,
|
||||||
|
|
||||||
|
[DateTime]$last_checkout,
|
||||||
|
|
||||||
|
[int]$assigned_to,
|
||||||
|
|
||||||
|
[int]$company_id,
|
||||||
|
|
||||||
|
[string]$serial,
|
||||||
|
|
||||||
|
[string]$order_number,
|
||||||
|
|
||||||
|
[int]$warranty_months,
|
||||||
|
|
||||||
|
[double]$purchase_cost,
|
||||||
|
|
||||||
|
[DateTime]$purchase_date,
|
||||||
|
|
||||||
|
[bool]$requestable,
|
||||||
|
|
||||||
|
[bool]$archived,
|
||||||
|
|
||||||
|
[int]$rtd_location_id,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $true)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
|
|
@ -59,11 +114,7 @@ function Set-Asset()
|
||||||
[hashtable] $customfields
|
[hashtable] $customfields
|
||||||
)
|
)
|
||||||
|
|
||||||
$Values = @{
|
$Values = . Get-ParameterValue
|
||||||
"name" = $Name
|
|
||||||
"status_id" = $status_id
|
|
||||||
"model_id" = $model_id
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($customfields)
|
if ($customfields)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue