From c88dd833235fd39b6808f7a6a261d25a8a5f0cb4 Mon Sep 17 00:00:00 2001 From: Petri Asikainen Date: Mon, 4 Jan 2021 08:53:47 +0200 Subject: [PATCH] Get-asset with -asset_tag --- SnipeitPS/Public/Get-Asset.ps1 | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/SnipeitPS/Public/Get-Asset.ps1 b/SnipeitPS/Public/Get-Asset.ps1 index ab1f4f4..2ebc8cf 100644 --- a/SnipeitPS/Public/Get-Asset.ps1 +++ b/SnipeitPS/Public/Get-Asset.ps1 @@ -60,6 +60,8 @@ function Get-Asset() { Param( [string]$search, + [string]$asset_tag, + [int]$order_number, [int]$model_id, @@ -98,8 +100,17 @@ function Get-Asset() { $SearchParameter = . Get-ParameterValue + $apiuri = "$url/api/v1/hardware" + + if ($asset_tag) { + if ( $search) { + Throw "[$($MyInvocation.MyCommand.Name)] Please specify only -search or -asset_tag parameter , not both " + } + $apiuri= "$url/api/v1/hardware/bytag/$asset_tag" + } + $Parameters = @{ - Uri = "$url/api/v1/hardware" + Uri = "$apiuri" Method = 'Get' GetParameters = $SearchParameter Token = $apiKey