@@ -20,12 +20,21 @@ Retrieve a list of assets that are due for auditing soon.
2020. PARAMETER audit_overdue
2121Retrieve a list of assets that are overdue for auditing.
2222
23+ . PARAMETER user_id
24+ Retrieve a list of assets checked out to user id.
25+
26+ . PARAMETER component_id
27+ Retrieve a list of assets assigned this component id.
28+
29+ . PARAMETER name
30+ Optionally restrict asset results to this asset name
31+
2332. PARAMETER order_number
2433Optionally restrict asset results to this order number
2534
2635. PARAMETER model_id
2736Optionally restrict asset results to this asset model ID
28-
37+
2938. PARAMETER category_id
3039Optionally restrict asset results to this category ID
3140
@@ -38,12 +47,22 @@ Optionally restrict asset results to this company ID
3847. PARAMETER location_id
3948Optionally restrict asset results to this location ID
4049
50+ . PARAMETER depreciation_id
51+ Optionally restrict asset results to this depreciation ID
52+
53+ . PARAMETER requestable
54+ Optionally restrict asset results to those set as requestable
55+
4156. PARAMETER status
4257Optionally restrict asset results to one of these status types: RTD, Deployed, Undeployable, Deleted, Archived, Requestable
4358
4459. PARAMETER status_id
4560Optionally restrict asset results to this status label ID
4661
62+ . PARAMETER customfields
63+ Hastable of custom fields and extra fields for searching assets in Snipe-It.
64+ Use internal field names from Snipe-It. You can use Get-CustomField to get internal field names.
65+
4766. PARAMETER sort
4867Specify the column name you wish to sort by
4968
@@ -132,6 +151,9 @@ function Get-SnipeitAsset() {
132151 [parameter (ParameterSetName = ' Assets with component id' )]
133152 [int ]$component_id ,
134153
154+ [parameter (ParameterSetName = ' Search' )]
155+ [string ]$name ,
156+
135157 [parameter (ParameterSetName = ' Search' )]
136158 [string ]$order_number ,
137159
@@ -162,6 +184,9 @@ function Get-SnipeitAsset() {
162184 [parameter (ParameterSetName = ' Search' )]
163185 [int ]$status_id ,
164186
187+ [parameter (ParameterSetName = ' Search' )]
188+ [hashtable ]$customfields ,
189+
165190 [parameter (ParameterSetName = ' Search' )]
166191 [parameter (ParameterSetName = ' Assets due auditing soon' )]
167192 [parameter (ParameterSetName = ' Assets overdue for auditing' )]
@@ -211,6 +236,15 @@ function Get-SnipeitAsset() {
211236
212237 $SearchParameter = . Get-ParameterValue - Parameters $MyInvocation.MyCommand.Parameters - BoundParameters $PSBoundParameters
213238
239+ # Add in custom fields.
240+ if ($customfields.Count -gt 0 ) {
241+ foreach ($pair in $customfields.GetEnumerator ()) {
242+ if (-Not $SearchParameter.ContainsKey ($pair.Name )) {
243+ $SearchParameter.Add ($pair.Name , $pair.Value )
244+ }
245+ }
246+ }
247+
214248 switch ($PsCmdlet.ParameterSetName ) {
215249 ' Search' { $api = " /api/v1/hardware" }
216250 ' Get with id' {$api = " /api/v1/hardware/$id " }
0 commit comments