From b61f89fee2c18ce22321e41c0cdc5753872becf7 Mon Sep 17 00:00:00 2001 From: Felix Date: Mon, 25 Jun 2018 16:06:58 +0200 Subject: [PATCH] Added Get-FieldSet --- SnipeitPS/Public/Get-Fieldset.ps1 | 37 ++++++++++++++++++++++++++++++ SnipeitPS/SnipeItPS.psd1 | Bin 9180 -> 9230 bytes 2 files changed, 37 insertions(+) create mode 100644 SnipeitPS/Public/Get-Fieldset.ps1 diff --git a/SnipeitPS/Public/Get-Fieldset.ps1 b/SnipeitPS/Public/Get-Fieldset.ps1 new file mode 100644 index 0000000..9e4058d --- /dev/null +++ b/SnipeitPS/Public/Get-Fieldset.ps1 @@ -0,0 +1,37 @@ +<# +.SYNOPSIS +# Gets a list of Snipe-it Fieldsets + +.PARAMETER url +URL of Snipeit system, can be set using Set-Info command + +.PARAMETER apiKey +Users API Key for Snipeit, can be set using Set-Info command + +.EXAMPLE +Get-Fieldset -url "https://assets.example.com" -token "token..." + +.EXAMPLE +Get-Fieldset -url "https://assets.example.com" -token "token..." | Where-Object {$_.name -eq "Windows" } + +#> + +function Get-Fieldset() { + Param( + [parameter(mandatory = $true)] + [string]$url, + + [parameter(mandatory = $true)] + [string]$apiKey + ) + + $Parameters = @{ + Uri = "$url/api/v1/fieldsets" + Method = 'Get' + Token = $apiKey + } + + $result = Invoke-SnipeitMethod @Parameters + + $result +} diff --git a/SnipeitPS/SnipeItPS.psd1 b/SnipeitPS/SnipeItPS.psd1 index 7bd75c476e2b723ba8e9962fc6c9353c16e63930..f100983f6a8f0b3e18708f0b266fd55049d02fd2 100644 GIT binary patch delta 34 qcmccP-siF5l<;H&VGd3=hD?T3h8%{J$&Esalg|lpY`!GSB>(`*