Skip to content

Commit bcd67ad

Browse files
authored
Merge pull request lwhitelock#16 from johnduprey/dev
Update Get-HuduAssets.ps1
2 parents 92c21d4 + 327d5ae commit bcd67ad

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

Public/Get-HuduAssets.ps1

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,22 @@ function Get-HuduAssets {
22
[CmdletBinding()]
33
Param (
44
[Int]$Id = '',
5-
[Alias("asset_layout_id")]
5+
[Alias('asset_layout_id')]
66
[Int]$AssetLayoutId = '',
7-
[Alias("company_id")]
7+
[Alias('company_id')]
88
[Int]$CompanyId = '',
99
[String]$Name = '',
1010
[Bool]$Archived = $false,
11-
[Alias("primary_serial")]
11+
[Alias('primary_serial')]
1212
[String]$PrimarySerial = ''
1313
)
1414

1515

1616
if ($id -and $CompanyId) {
1717
$Asset = Invoke-HuduRequest -Method get -Resource "/api/v1/companies/$CompanyId/assets/$Id"
1818
return $Asset
19-
} else {
19+
}
20+
else {
2021

2122
$ResourceFilter = ''
2223

@@ -39,6 +40,10 @@ function Get-HuduAssets {
3940
if ($PrimarySerial) {
4041
$ResourceFilter = "$($ResourceFilter)&primary_serial=$($PrimarySerial)"
4142
}
43+
44+
if ($Id) {
45+
$ResourceFilter = "$($ResourceFilter)&id=$($Id)"
46+
}
4247

4348
$i = 1;
4449
$AllAssets = do {
@@ -47,12 +52,7 @@ function Get-HuduAssets {
4752
$Assets.Assets
4853
} while ($Assets.Assets.count % 1000 -eq 0 -and $Assets.Assets.count -ne 0)
4954

50-
51-
if ($id) {
52-
$AllAssets = $AllAssets | where-object { $_.id -eq $id }
53-
}
54-
5555
return $AllAssets
56-
5756
}
5857
}
58+

0 commit comments

Comments
 (0)