mirror of
https://github.com/snazy2000/SnipeitPS.git
synced 2025-12-13 18:02:30 +00:00
Get-asset by serial
This commit is contained in:
parent
d78d5d5281
commit
2925106297
1 changed files with 19 additions and 2 deletions
|
|
@ -8,6 +8,9 @@ A text string to search the assets data
|
||||||
.PARAMETER asset_tag
|
.PARAMETER asset_tag
|
||||||
Specify exact asset tag to query
|
Specify exact asset tag to query
|
||||||
|
|
||||||
|
.PARAMETER asset_serial
|
||||||
|
Specify exact asset serial to query
|
||||||
|
|
||||||
.PARAMETER order_number
|
.PARAMETER order_number
|
||||||
Optionally restrict asset results to this order number
|
Optionally restrict asset results to this order number
|
||||||
|
|
||||||
|
|
@ -68,6 +71,8 @@ function Get-Asset() {
|
||||||
|
|
||||||
[string]$asset_tag,
|
[string]$asset_tag,
|
||||||
|
|
||||||
|
[string]$asset_serial,
|
||||||
|
|
||||||
[int]$order_number,
|
[int]$order_number,
|
||||||
|
|
||||||
[int]$model_id,
|
[int]$model_id,
|
||||||
|
|
@ -106,15 +111,27 @@ function Get-Asset() {
|
||||||
|
|
||||||
$SearchParameter = . Get-ParameterValue
|
$SearchParameter = . Get-ParameterValue
|
||||||
|
|
||||||
|
|
||||||
$apiuri = "$url/api/v1/hardware"
|
$apiuri = "$url/api/v1/hardware"
|
||||||
|
|
||||||
|
if ($search -and ($asset_tag -or $asset_serial)) {
|
||||||
|
Throw "[$($MyInvocation.MyCommand.Name)] Please specify only -search , -asset_tag or -asset_serial parameter , not both "
|
||||||
|
}
|
||||||
|
|
||||||
if ($asset_tag) {
|
if ($asset_tag) {
|
||||||
if ( $search) {
|
if ( $search -or $asset_serial) {
|
||||||
Throw "[$($MyInvocation.MyCommand.Name)] Please specify only -search or -asset_tag parameter , not both "
|
Throw "[$($MyInvocation.MyCommand.Name)] Please specify only -search , -asset_tag or -asset_serial parameter , not both "
|
||||||
}
|
}
|
||||||
$apiuri= "$url/api/v1/hardware/bytag/$asset_tag"
|
$apiuri= "$url/api/v1/hardware/bytag/$asset_tag"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($asset_serial) {
|
||||||
|
if ( $search -or $asset_tag) {
|
||||||
|
Throw "[$($MyInvocation.MyCommand.Name)] Please specify only -search , -asset_tag or -asset_serial parameter , not both "
|
||||||
|
}
|
||||||
|
$apiuri= "$url/api/v1/hardware/byserial/$asset_serial"
|
||||||
|
}
|
||||||
|
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$apiuri"
|
Uri = "$apiuri"
|
||||||
Method = 'Get'
|
Method = 'Get'
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue