diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..aeb28de --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,32 @@ +## Context + + + +## Your Environment + +* SnipitPS Module version used: +* Operating System and PowerShell version: +* Snipe It version: + +## Expected Behavior + + + +## Current Behavior + + + +## Possible Solution + + + +## Steps to Reproduce (for bugs) + + +1. +2. +3. +4. + + + diff --git a/CHANGELOG.md b/CHANGELOG.md index 91fc4d9..b27a3c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,31 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/), and this project adheres to [Semantic Versioning](http://semver.org/). + +# [v.1.8.x] - 2021-06-17 + +## Support for new Snipe it endpoints + +## New features + +Get-SnipeitAccessories -user_id +returns accessories checked out to user id + +Get-SnipeitAsset -user_id +Return Assets checked out to user id + +Get-SnipeitAsset -component_id +Returns assets with specific component id + +Get-SnipeitLicense -user_id +Get licenses checked out to user ID + +Get-SnipeitLicense -asset_id +Get licenses checked out to asset ID + +Get-SnipeitUser -accessory_id +Get users that have specific accessory id checked out + # [v.1.7.x] - 2021-06-14 ## Consumables diff --git a/SnipeitPS/Public/Get-SnipeitAccessory.ps1 b/SnipeitPS/Public/Get-SnipeitAccessory.ps1 index 88d6429..1a84a71 100644 --- a/SnipeitPS/Public/Get-SnipeitAccessory.ps1 +++ b/SnipeitPS/Public/Get-SnipeitAccessory.ps1 @@ -32,6 +32,10 @@ Get-SnipeitAccessory -search Keyboard .EXAMPLE Get-SnipeitAccessory -id 1 +.EXAMPLE +Get-SnipeitAccessory -user_id 1 +Get accessories checked out to user ID 1 + #> function Get-SnipeitAccessory() { @@ -43,6 +47,9 @@ function Get-SnipeitAccessory() { [parameter(ParameterSetName='Get by ID')] [int]$id, + [parameter(ParameterSetName='Accessories checked out to user id')] + [int]$user_id, + [parameter(ParameterSetName='Search')] [int]$company_id, @@ -69,6 +76,7 @@ function Get-SnipeitAccessory() { [int]$offset, [parameter(ParameterSetName='Search')] + [parameter(ParameterSetName='Accessories checked out to user id')] [switch]$all = $false, [parameter(mandatory = $true)] @@ -79,23 +87,21 @@ function Get-SnipeitAccessory() { ) Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name - if ($id -and $search){ - throw "Please specify only one of -id or -search parameter" + switch($PsCmdlet.ParameterSetName) { + 'Search' {$apiurl = "$url/api/v1/accessories"} + 'Get by ID' {$apiurl= "$url/api/v1/accessories/$id"} + 'Accessories checked out to user id' {$apiurl = "$url/api/v1/users/$user_id/accessories"} } $SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters $Parameters = @{ - Uri = "$url/api/v1/accessories" + Uri = $apiurl Method = 'Get' GetParameters = $SearchParameter Token = $apiKey } - if($id){ - $Parameters.Uri ="$url/api/v1/accessories/$id" - } - if ($all) { $offstart = $(if($offset){$offset} Else {0}) $callargs = $SearchParameter diff --git a/SnipeitPS/Public/Get-SnipeitAsset.ps1 b/SnipeitPS/Public/Get-SnipeitAsset.ps1 index 99afa60..ac38bcb 100644 --- a/SnipeitPS/Public/Get-SnipeitAsset.ps1 +++ b/SnipeitPS/Public/Get-SnipeitAsset.ps1 @@ -66,16 +66,42 @@ URL of Snipeit system, can be set using Set-SnipeitInfo command Users API Key for Snipeit, can be set using Set-SnipeitInfo command .EXAMPLE -Get-SnipeitAsset -url "https://assets.example.com"-token "token..." +Get-SnipeitAsset -all -url "https://assets.example.com"-token "token..." +Returens all assets .EXAMPLE -Get-SnipeitAsset -search "myMachine"-url "https://assets.example.com"-token "token..." +Get-SnipeitAsset -search "myMachine" +Search for specific asset .EXAMPLE -Get-SnipeitAsset -search "myMachine"-url "https://assets.example.com"-token "token..." +Get-SnipeitAsset -id 3 +Get asset with id number 3 .EXAMPLE -Get-SnipeitAsset -asset_tag "myAssetTag"-url "https://assets.example.com"-token "token..." +Get-SnipeitAsset -asset_tag snipe0003 +Get asset with asset tag snipe00033 + +.EXAMPLE +Get-SnipeitAsset -serial 1234 +Get asset with searial number 1234 + +.EXAMPLE +Get-SnipeitAsser -audit_due +Get Assets due auditing soon + +.EXAMPLE +Get-SnipeitAsser -audit_overdue +Get Assets overdue for auditing + +.EXAMPLE +Get-AnipeitAsset -user_id 4 +Get Assets checked out to user id 4 + +.EXAMPLE +Get-SnipeitAsset -component_id 5 +Get Assets with component id 5 + + #> function Get-SnipeitAsset() { @@ -100,6 +126,12 @@ function Get-SnipeitAsset() { [parameter(ParameterSetName='Assets overdue for auditing')] [switch]$audit_overdue, + [parameter(ParameterSetName='Assets checked out to user id')] + [int]$user_id, + + [parameter(ParameterSetName='Assets with component id')] + [int]$component_id, + [parameter(ParameterSetName='Search')] [string]$order_number, @@ -133,28 +165,38 @@ function Get-SnipeitAsset() { [parameter(ParameterSetName='Search')] [parameter(ParameterSetName='Assets due auditing soon')] [parameter(ParameterSetName='Assets overdue for auditing')] + [parameter(ParameterSetName='Assets checked out to user id')] + [parameter(ParameterSetName='Assets with component id')] [ValidateSet('id','created_at','asset_tag','serial','order_number','model_id','category_id','manufacturer_id','company_id','location_id','status','status_id')] [string]$sort, [parameter(ParameterSetName='Search')] [parameter(ParameterSetName='Assets due auditing soon')] [parameter(ParameterSetName='Assets overdue for auditing')] + [parameter(ParameterSetName='Assets checked out to user id')] + [parameter(ParameterSetName='Assets with component id')] [ValidateSet("asc", "desc")] [string]$order, [parameter(ParameterSetName='Search')] [parameter(ParameterSetName='Assets due auditing soon')] [parameter(ParameterSetName='Assets overdue for auditing')] + [parameter(ParameterSetName='Assets checked out to user id')] + [parameter(ParameterSetName='Assets with component id')] [int]$limit = 50, [parameter(ParameterSetName='Search')] [parameter(ParameterSetName='Assets due auditing soon')] [parameter(ParameterSetName='Assets overdue for auditing')] + [parameter(ParameterSetName='Assets checked out to user id')] + [parameter(ParameterSetName='Assets with component id')] [int]$offset, [parameter(ParameterSetName='Search')] [parameter(ParameterSetName='Assets due auditing soon')] [parameter(ParameterSetName='Assets overdue for auditing')] + [parameter(ParameterSetName='Assets checked out to user id')] + [parameter(ParameterSetName='Assets with component id')] [switch]$all = $false, [parameter(mandatory = $true)] @@ -172,9 +214,11 @@ function Get-SnipeitAsset() { 'Search' { $apiurl = "$url/api/v1/hardware" } 'Get with id' {$apiurl= "$url/api/v1/hardware/$id"} 'Get with asset tag' {$apiurl= "$url/api/v1/hardware/bytag/$asset_tag"} - 'Get with serial' { $apiurl= "$url/api/v1/hardware/byserial/$asset_serial"} + 'Get with serial' { $apiurl= "$url/api/v1/hardware/byserial/$serial"} 'Assets due auditing soon' {$apiurl = "$url/api/v1/hardware/audit/due"} 'Assets overdue for auditing' {$apiurl = "$url/api/v1/hardware/audit/overdue"} + 'Assets checked out to user id'{$apiurl = "$url/api/v1/users/$user_id/assets"} + 'Assets with component id' {$apiurl = "$url/api/v1/components/$component_id/assets"} } $Parameters = @{ diff --git a/SnipeitPS/Public/Get-SnipeitLicense.ps1 b/SnipeitPS/Public/Get-SnipeitLicense.ps1 index 90a9b31..ba4a4d9 100644 --- a/SnipeitPS/Public/Get-SnipeitLicense.ps1 +++ b/SnipeitPS/Public/Get-SnipeitLicense.ps1 @@ -41,6 +41,12 @@ function Get-SnipeitLicense() { [parameter(ParameterSetName='Get with ID')] [int]$id, + [parameter(ParameterSetName='Get licenses checked out to user ID')] + [int]$user_id, + + [parameter(ParameterSetName='Get licenses checked out to asset ID')] + [int]$asset_id, + [parameter(ParameterSetName='Search')] [string]$name, @@ -87,7 +93,8 @@ function Get-SnipeitLicense() { [parameter(ParameterSetName='Search')] [int]$offset, - + [parameter(ParameterSetName='Get licenses checked out to user ID')] + [parameter(ParameterSetName='Get licenses checked out to asset ID')] [parameter(ParameterSetName='Search')] [switch]$all = $false, @@ -102,14 +109,11 @@ function Get-SnipeitLicense() { $SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters - $apiurl = "$url/api/v1/licenses" - - if ($search -and $id ) { - Throw "[$($MyInvocation.MyCommand.Name)] Please specify only -search or -id parameter , not both " - } - - if ($id) { - $apiurl= "$url/api/v1/licenses/$id" + switch($PsCmdlet.ParameterSetName) { + 'Search' {$apiurl = "$url/api/v1/licenses"} + 'Get with ID' {$apiurl= "$url/api/v1/licenses/$id"} + 'Get licenses checked out to user ID' {$apiurl= "$url/api/v1/users/$user_id/licenses"} + 'Get licenses checked out to asset ID' {$apiurl= "$url/api/v1/hardware/$asset_id/licenses"} } $Parameters = @{ diff --git a/SnipeitPS/Public/Get-SnipeitUser.ps1 b/SnipeitPS/Public/Get-SnipeitUser.ps1 index 61e6e37..2d3381e 100644 --- a/SnipeitPS/Public/Get-SnipeitUser.ps1 +++ b/SnipeitPS/Public/Get-SnipeitUser.ps1 @@ -40,6 +40,10 @@ Get-SnipeitUser -username someuser .EXAMPLE Get-SnipeitUser -email user@somedomain.com + +.EXAMPLE +Get-SnipeitUser -accessory_id 3 +Get users with accessory id 3 has been checked out to #> function Get-SnipeitUser() { @@ -51,6 +55,9 @@ function Get-SnipeitUser() { [parameter(ParameterSetName='Get with ID')] [string]$id, + [parameter(ParameterSetName='Get users a specific accessory id has been checked out to')] + [string]$accessory_id, + [parameter(ParameterSetName='Search')] [int]$company_id, @@ -80,6 +87,7 @@ function Get-SnipeitUser() { [int]$offset, [parameter(ParameterSetName='Search')] + [parameter(ParameterSetName='Get users a specific accessory id has been checked out to')] [switch]$all = $false, [parameter(mandatory = $true)] @@ -92,16 +100,12 @@ function Get-SnipeitUser() { Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name $SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters - - $apiurl = "$url/api/v1/users" - - if ($search -and $id ) { - Throw "[$($MyInvocation.MyCommand.Name)] Please specify only -search or -id parameter , not both " + switch ($PsCmdlet.ParameterSetName) { + 'Search' { $apiurl = "$url/api/v1/users"} + 'Get with id' {$apiurl= "$url/api/v1/users/$id"} + 'Get users a specific accessory id has been checked out to' {$apiurl= "$url/api/v1/accessories/$accessory_id/checkedout"} } - if ($id) { - $apiurl= "$url/api/v1/users/$id" - } $Parameters = @{ Uri = $apiurl Method = 'Get' diff --git a/SnipeitPS/Public/New-SnipeitAccessory.ps1 b/SnipeitPS/Public/New-SnipeitAccessory.ps1 index 83654e6..a7df00d 100644 --- a/SnipeitPS/Public/New-SnipeitAccessory.ps1 +++ b/SnipeitPS/Public/New-SnipeitAccessory.ps1 @@ -23,6 +23,9 @@ ID Number of the company the accessory is assigned to .PARAMETER manufacturer_id ID number of the manufacturer for this accessory. +.PARAMETER model_number +Model number for this accessory + .PARAMETER order_number Order number for this accessory. @@ -47,7 +50,7 @@ ID number of the supplier for this accessory .PARAMETER location_id ID number of the location the accessory is assigned to -.PARAMETER min_qty +.PARAMETER min_amt Min quantity of the accessory before alert is triggered .PARAMETER url @@ -86,11 +89,13 @@ function New-SnipeitAccessory() { [string]$order_number, + [string]$model_number, + [float]$purchase_cost, [datetime]$purchase_date, - [int]$min_qty, + [int]$min_amt, [ValidateRange(1, [int]::MaxValue)] [int]$supplier_id, diff --git a/SnipeitPS/Public/New-SnipeitUser.ps1 b/SnipeitPS/Public/New-SnipeitUser.ps1 index 0077eb8..108fc3c 100644 --- a/SnipeitPS/Public/New-SnipeitUser.ps1 +++ b/SnipeitPS/Public/New-SnipeitUser.ps1 @@ -17,6 +17,9 @@ .PARAMETER active Can user log in to snipe-it? + .PARAMETER password + Password for user + .PARAMETER notes User Notes diff --git a/SnipeitPS/Public/Set-SnipeitAccessory.ps1 b/SnipeitPS/Public/Set-SnipeitAccessory.ps1 index 9c14436..2a10a2c 100644 --- a/SnipeitPS/Public/Set-SnipeitAccessory.ps1 +++ b/SnipeitPS/Public/Set-SnipeitAccessory.ps1 @@ -14,6 +14,9 @@ Notes about the accessory .PARAMETER qty Quantity of the accessory you have +.PARAMETER min_amt +Minimum amount of the accessory, before alert is triggered + .PARAMETER category_id ID number of the category the accessory belongs to @@ -23,6 +26,9 @@ ID Number of the company the accessory is assigned to .PARAMETER manufacturer_id ID number of the manufacturer for this accessory. +.PARAMETER model_number +Model number for this accessory + .PARAMETER order_number Order number for this accessory. @@ -78,12 +84,11 @@ function Set-SnipeitAccessory() { [ValidateRange(1, [int]::MaxValue)] [int]$category_id, - [ValidateRange(1, [int]::MaxValue)] - [int]$company_id, + [Nullable[System.Int32]]$company_id, - [ValidateRange(1, [int]::MaxValue)] - [int]$manufacturer_id, + [Nullable[System.Int32]]$manufacturer_id, + [string]$model_number, [string]$order_number, @@ -91,10 +96,9 @@ function Set-SnipeitAccessory() { [datetime]$purchase_date, - [bool]$min_qty, + [Nullable[System.Int32]]$min_amt, - [ValidateRange(1, [int]::MaxValue)] - [int]$supplier_id, + [Nullable[System.Int32]]$supplier_id, [parameter(mandatory = $true)] [string]$url, diff --git a/SnipeitPS/Public/Set-SnipeitAsset.ps1 b/SnipeitPS/Public/Set-SnipeitAsset.ps1 index f64e253..856a92a 100644 --- a/SnipeitPS/Public/Set-SnipeitAsset.ps1 +++ b/SnipeitPS/Public/Set-SnipeitAsset.ps1 @@ -89,21 +89,23 @@ function Set-SnipeitAsset() [string]$name, + [ValidateRange(1, [int]::MaxValue)] [int]$status_id, + [ValidateRange(1, [int]::MaxValue)] [int]$model_id, [DateTime]$last_checkout, - [int]$assigned_to, + [Nullable[System.Int32]]$assigned_to, - [int]$company_id, + [Nullable[System.Int32]]$company_id, [string]$serial, [string]$order_number, - [int]$warranty_months, + [Nullable[System.Int32]]$warranty_months, [double]$purchase_cost, @@ -113,7 +115,7 @@ function Set-SnipeitAsset() [bool]$archived, - [int]$rtd_location_id, + [Nullable[System.Int32]]$rtd_location_id, [string]$notes, diff --git a/SnipeitPS/Public/Set-SnipeitComponent.ps1 b/SnipeitPS/Public/Set-SnipeitComponent.ps1 index 681d380..d85a286 100644 --- a/SnipeitPS/Public/Set-SnipeitComponent.ps1 +++ b/SnipeitPS/Public/Set-SnipeitComponent.ps1 @@ -17,6 +17,9 @@ ID number of category .PARAMETER qty Quantity of the components you have +.PARAMETER min_amt +Minimum Quantity of the components before alert is triggered + .PARAMETER location_id ID number of the location the accessory is assigned to @@ -55,11 +58,13 @@ function Set-SnipeitComponent() [parameter(mandatory = $true)] [int]$qty, + [Nullable[System.Int32]]$min_amt, + [string]$name, - [int]$company_id, + [Nullable[System.Int32]]$company_id, - [int]$location_id, + [Nullable[System.Int32]]$location_id, [string]$order_number, diff --git a/SnipeitPS/Public/Set-SnipeitConsumable.ps1 b/SnipeitPS/Public/Set-SnipeitConsumable.ps1 index 5dd8960..b98805d 100644 --- a/SnipeitPS/Public/Set-SnipeitConsumable.ps1 +++ b/SnipeitPS/Public/Set-SnipeitConsumable.ps1 @@ -75,25 +75,27 @@ function Set-SnipeitConsumable() [string]$name, [parameter(mandatory = $false)] + [ValidateRange(1, [int]::MaxValue)] [int]$qty, [parameter(mandatory = $false)] + [ValidateRange(1, [int]::MaxValue)] [int]$category_id, [parameter(mandatory = $false)] - [int]$min_amt, + [Nullable[System.Int32]]$min_amt, [parameter(mandatory = $false)] - [int]$company_id, + [Nullable[System.Int32]]$company_id, [parameter(mandatory = $false)] [string]$order_number, [parameter(mandatory = $false)] - [int]$manufacturer_id, + [Nullable[System.Int32]]$manufacturer_id, [parameter(mandatory = $false)] - [int]$location_id, + [Nullable[System.Int32]]$location_id, [parameter(mandatory = $false)] [bool]$requestable, diff --git a/SnipeitPS/Public/Set-SnipeitDepartment.ps1 b/SnipeitPS/Public/Set-SnipeitDepartment.ps1 index 063ec2d..dd4830b 100644 --- a/SnipeitPS/Public/Set-SnipeitDepartment.ps1 +++ b/SnipeitPS/Public/Set-SnipeitDepartment.ps1 @@ -43,11 +43,11 @@ function Set-SnipeitDepartment() { [string]$name, - [int]$company_id, + [Nullable[System.Int32]]$company_id, - [int]$location_id, + [Nullable[System.Int32]]$location_id, - [int]$manager_id, + [Nullable[System.Int32]]$manager_id, [string]$notes, diff --git a/SnipeitPS/Public/Set-SnipeitLicense.ps1 b/SnipeitPS/Public/Set-SnipeitLicense.ps1 index ea99b9d..c853441 100644 --- a/SnipeitPS/Public/Set-SnipeitLicense.ps1 +++ b/SnipeitPS/Public/Set-SnipeitLicense.ps1 @@ -89,12 +89,11 @@ function Set-SnipeitLicense() { [ValidateRange(1, [int]::MaxValue)] [int]$category_id, - [ValidateRange(1, [int]::MaxValue)] - [int]$company_id, + + [Nullable[System.Int32]]$company_id, [datetime]$expiration_date, - [ValidateLength(1, 120)] [mailaddress]$license_email, [ValidateLength(1, 100)] @@ -118,8 +117,7 @@ function Set-SnipeitLicense() { [string]$serial, - [ValidateRange(1, [int]::MaxValue)] - [int]$supplier_id, + [Nullable[System.Int32]]$supplier_id, [datetime]$termination_date, diff --git a/SnipeitPS/Public/Set-SnipeitLicenseSeat.ps1 b/SnipeitPS/Public/Set-SnipeitLicenseSeat.ps1 index 9a42a09..838c652 100644 --- a/SnipeitPS/Public/Set-SnipeitLicenseSeat.ps1 +++ b/SnipeitPS/Public/Set-SnipeitLicenseSeat.ps1 @@ -23,13 +23,17 @@ User's API Key for Snipeit, can be set using Set-SnipeitInfo command .EXAMPLE - Set-SnipeitLicenceSeat -ID 1 -seat_id 1 -assigned_id 3 -Verbose + Set-SnipeitLicenceSeat -ID 1 -seat_id 1 -assigned_id 3 Checkout licence to user id 3 .EXAMPLE - Set-SnipeitLicenceSeat -ID 1 -seat_id 1 -asset_id 3 -Verbose + Set-SnipeitLicenceSeat -ID 1 -seat_id 1 -asset_id 3 Checkout licence to asset id 3 + .EXAMPLE + Set-SnipeitLicenceSeat -ID 1 -seat_id 1 -asset_id $null -assigned_id $null + Checkin licence seat id 1 of licence id 1 + #> function Set-SnipeitLicenseSeat() { diff --git a/SnipeitPS/Public/Set-SnipeitLocation.ps1 b/SnipeitPS/Public/Set-SnipeitLocation.ps1 index 05a0c1b..a5ff9f2 100644 --- a/SnipeitPS/Public/Set-SnipeitLocation.ps1 +++ b/SnipeitPS/Public/Set-SnipeitLocation.ps1 @@ -82,11 +82,11 @@ function Set-SnipeitLocation() { [string]$currency, - [int]$manager_id, + [Nullable[System.Int32]]$manager_id, [string]$ldap_ou, - [int]$parent_id, + [Nullable[System.Int32]]$parent_id, [parameter(mandatory = $true)] [string]$url, diff --git a/SnipeitPS/Public/Set-SnipeitModel.ps1 b/SnipeitPS/Public/Set-SnipeitModel.ps1 index 312d8f1..d46258b 100644 --- a/SnipeitPS/Public/Set-SnipeitModel.ps1 +++ b/SnipeitPS/Public/Set-SnipeitModel.ps1 @@ -52,11 +52,10 @@ function Set-SnipeitModel() { [int]$manufacturer_id, - [ValidateRange(1, 240)] - [int]$eol, + [Nullable[System.Int32]]$eol, [Alias("fieldset_id")] - [int]$custom_fieldset_id, + [Nullable[System.Int32]]$custom_fieldset_id, [parameter(mandatory = $true)] [string]$url, diff --git a/SnipeitPS/Public/Set-SnipeitUser.ps1 b/SnipeitPS/Public/Set-SnipeitUser.ps1 index 256abeb..341258e 100644 --- a/SnipeitPS/Public/Set-SnipeitUser.ps1 +++ b/SnipeitPS/Public/Set-SnipeitUser.ps1 @@ -20,6 +20,9 @@ .PARAMETER activated Can user log in to snipe-it? + .PARAMETER password + Password for user + .PARAMETER notes User Notes @@ -74,10 +77,12 @@ function Set-SnipeitUser() { [parameter(mandatory = $true,ValueFromPipelineByPropertyName)] [int[]]$id, + [ValidateLength(1,256)] [string]$first_name, [string]$last_name, + [ValidateLength(1,256)] [string]$userName, [string]$jobtitle, @@ -86,13 +91,15 @@ function Set-SnipeitUser() { [string]$phone, - [int]$company_id, + [string]$password, - [int]$location_id, + [Nullable[System.Int32]]$company_id, - [int]$department_id, + [Nullable[System.Int32]]$location_id, - [int]$manager_id, + [Nullable[System.Int32]]$department_id, + + [Nullable[System.Int32]]$manager_id, [string]$employee_num, @@ -111,6 +118,10 @@ function Set-SnipeitUser() { $Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters + if ($password) { + $Values['password_confirmation'] = $password + } + } process{ diff --git a/SnipeitPS/SnipeitPS.psd1 b/SnipeitPS/SnipeitPS.psd1 index f5c1113..dbbb9ef 100644 --- a/SnipeitPS/SnipeitPS.psd1 +++ b/SnipeitPS/SnipeitPS.psd1 @@ -12,7 +12,7 @@ RootModule = 'SnipeitPS' # Version number of this module. -ModuleVersion = '1.7' +ModuleVersion = '1.8' # Supported PSEditions # CompatiblePSEditions = @() diff --git a/appveyor.yml b/appveyor.yml index 0fb5249..a316978 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -17,7 +17,7 @@ environment: secure: UdM6qhf5B0G8liHhUrwWERCZr44iSqmg4jUq0lwlTjZs4KyeoiwnBzdej0phqIAm PShell: '5' -version: 1.7.{build} +version: 1.8.{build} # Don't rebuild when I tag a release on GitHub skip_tags: true diff --git a/docs/Get-SnipeitAccessory.md b/docs/Get-SnipeitAccessory.md index 366aecc..680c5a1 100644 --- a/docs/Get-SnipeitAccessory.md +++ b/docs/Get-SnipeitAccessory.md @@ -24,6 +24,11 @@ Get-SnipeitAccessory [-search ] [-company_id ] [-category_id ] -url -apiKey [] ``` +### Accessories checked out to user id +``` +Get-SnipeitAccessory [-user_id ] [-all] -url -apiKey [] +``` + ## DESCRIPTION Gets a list of Snipe-it Accessories @@ -39,6 +44,12 @@ Get-SnipeitAccessory -search Keyboard Get-SnipeitAccessory -id 1 ``` +### EXAMPLE 3 +``` +Get-SnipeitAccessory -user_id 1 +Get accessories checked out to user ID 1 +``` + ## PARAMETERS ### -all @@ -46,7 +57,7 @@ A return all results, works with -offset and other parameters ```yaml Type: SwitchParameter -Parameter Sets: Search +Parameter Sets: Search, Accessories checked out to user id Aliases: Required: False @@ -238,6 +249,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -user_id +{{ Fill user_id Description }} + +```yaml +Type: Int32 +Parameter Sets: Accessories checked out to user id +Aliases: + +Required: False +Position: Named +Default value: 0 +Accept pipeline input: False +Accept wildcard characters: False +``` + ### CommonParameters This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). diff --git a/docs/Get-SnipeitAsset.md b/docs/Get-SnipeitAsset.md index 66e3724..db43ac2 100644 --- a/docs/Get-SnipeitAsset.md +++ b/docs/Get-SnipeitAsset.md @@ -47,6 +47,18 @@ Get-SnipeitAsset [-audit_overdue] [-sort ] [-order ] [-limit -apiKey [] ``` +### Assets checked out to user id +``` +Get-SnipeitAsset [-user_id ] [-sort ] [-order ] [-limit ] [-offset ] + [-all] -url -apiKey [] +``` + +### Assets with component id +``` +Get-SnipeitAsset [-component_id ] [-sort ] [-order ] [-limit ] [-offset ] + [-all] -url -apiKey [] +``` + ## DESCRIPTION {{ Fill in the Description }} @@ -54,22 +66,56 @@ Get-SnipeitAsset [-audit_overdue] [-sort ] [-order ] [-limit ] [-name ] [-company_id ] [-p Get-SnipeitLicense [-id ] -url -apiKey [] ``` +### Get licenses checked out to user ID +``` +Get-SnipeitLicense [-user_id ] [-all] -url -apiKey [] +``` + +### Get licenses checked out to asset ID +``` +Get-SnipeitLicense [-asset_id ] [-all] -url -apiKey [] +``` + ## DESCRIPTION {{ Fill in the Description }} @@ -48,7 +58,7 @@ A return all results, works with -offset and other parameters ```yaml Type: SwitchParameter -Parameter Sets: Search +Parameter Sets: Search, Get licenses checked out to user ID, Get licenses checked out to asset ID Aliases: Required: False @@ -73,6 +83,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -asset_id +{{ Fill asset_id Description }} + +```yaml +Type: Int32 +Parameter Sets: Get licenses checked out to asset ID +Aliases: + +Required: False +Position: Named +Default value: 0 +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -category_id {{ Fill category_id Description }} @@ -345,6 +370,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -user_id +{{ Fill user_id Description }} + +```yaml +Type: Int32 +Parameter Sets: Get licenses checked out to user ID +Aliases: + +Required: False +Position: Named +Default value: 0 +Accept pipeline input: False +Accept wildcard characters: False +``` + ### CommonParameters This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). diff --git a/docs/Get-SnipeitUser.md b/docs/Get-SnipeitUser.md index eecb667..05e6766 100644 --- a/docs/Get-SnipeitUser.md +++ b/docs/Get-SnipeitUser.md @@ -24,6 +24,11 @@ Get-SnipeitUser [-search ] [-company_id ] [-location_id ] Get-SnipeitUser [-id ] -url -apiKey [] ``` +### Get users a specific accessory id has been checked out to +``` +Get-SnipeitUser [-accessory_id ] [-all] -url -apiKey [] +``` + ## DESCRIPTION {{ Fill in the Description }} @@ -49,14 +54,35 @@ Get-SnipeitUser -username someuser Get-SnipeitUser -email user@somedomain.com ``` +### EXAMPLE 5 +``` +Get-SnipeitUser -accessory_id 3 +Get users with accessory id 3 has been checked out to +``` + ## PARAMETERS +### -accessory_id +{{ Fill accessory_id Description }} + +```yaml +Type: String +Parameter Sets: Get users a specific accessory id has been checked out to +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -all A return all results, works with -offset and other parameters ```yaml Type: SwitchParameter -Parameter Sets: Search +Parameter Sets: Search, Get users a specific accessory id has been checked out to Aliases: Required: False diff --git a/docs/New-SnipeitAccessory.md b/docs/New-SnipeitAccessory.md index a9e27c1..de15744 100644 --- a/docs/New-SnipeitAccessory.md +++ b/docs/New-SnipeitAccessory.md @@ -14,8 +14,8 @@ Creates new accessory on Snipe-It system ``` New-SnipeitAccessory [-name] [-qty] [-category_id] [[-company_id] ] - [[-manufacturer_id] ] [[-order_number] ] [[-purchase_cost] ] - [[-purchase_date] ] [[-min_qty] ] [[-supplier_id] ] [[-location_id] ] + [[-manufacturer_id] ] [[-order_number] ] [[-model_number] ] [[-purchase_cost] ] + [[-purchase_date] ] [[-min_amt] ] [[-supplier_id] ] [[-location_id] ] [-url] [-apiKey] [-WhatIf] [-Confirm] [] ``` @@ -40,7 +40,7 @@ Parameter Sets: (All) Aliases: Required: True -Position: 13 +Position: 14 Default value: None Accept pipeline input: False Accept wildcard characters: False @@ -85,7 +85,7 @@ Parameter Sets: (All) Aliases: Required: False -Position: 11 +Position: 12 Default value: 0 Accept pipeline input: False Accept wildcard characters: False @@ -106,7 +106,7 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -min_qty +### -min_amt Min quantity of the accessory before alert is triggered ```yaml @@ -115,12 +115,27 @@ Parameter Sets: (All) Aliases: Required: False -Position: 9 +Position: 10 Default value: 0 Accept pipeline input: False Accept wildcard characters: False ``` +### -model_number +Model number for this accessory + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 7 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -name Accessory name @@ -160,7 +175,7 @@ Parameter Sets: (All) Aliases: Required: False -Position: 7 +Position: 8 Default value: 0 Accept pipeline input: False Accept wildcard characters: False @@ -175,7 +190,7 @@ Parameter Sets: (All) Aliases: Required: False -Position: 8 +Position: 9 Default value: None Accept pipeline input: False Accept wildcard characters: False @@ -205,7 +220,7 @@ Parameter Sets: (All) Aliases: Required: False -Position: 10 +Position: 11 Default value: 0 Accept pipeline input: False Accept wildcard characters: False @@ -220,7 +235,7 @@ Parameter Sets: (All) Aliases: Required: True -Position: 12 +Position: 13 Default value: None Accept pipeline input: False Accept wildcard characters: False diff --git a/docs/New-SnipeitUser.md b/docs/New-SnipeitUser.md index b65f9a2..99a4cc0 100644 --- a/docs/New-SnipeitUser.md +++ b/docs/New-SnipeitUser.md @@ -229,7 +229,7 @@ Accept wildcard characters: False ``` ### -password -{{ Fill password Description }} +Password for user ```yaml Type: String diff --git a/docs/Set-SnipeitAccessory.md b/docs/Set-SnipeitAccessory.md index ae2b45c..9adeae2 100644 --- a/docs/Set-SnipeitAccessory.md +++ b/docs/Set-SnipeitAccessory.md @@ -14,9 +14,9 @@ Updates accessory on Snipe-It system ``` Set-SnipeitAccessory [-id] [[-name] ] [[-qty] ] [[-category_id] ] - [[-company_id] ] [[-manufacturer_id] ] [[-order_number] ] [[-purchase_cost] ] - [[-purchase_date] ] [[-min_qty] ] [[-supplier_id] ] [-url] - [-apiKey] [-WhatIf] [-Confirm] [] + [[-company_id] ] [[-manufacturer_id] ] [[-model_number] ] [[-order_number] ] + [[-purchase_cost] ] [[-purchase_date] ] [[-min_amt] ] [[-supplier_id] ] + [-url] [-apiKey] [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -40,7 +40,7 @@ Parameter Sets: (All) Aliases: Required: True -Position: 13 +Position: 14 Default value: None Accept pipeline input: False Accept wildcard characters: False @@ -71,7 +71,7 @@ Aliases: Required: False Position: 5 -Default value: 0 +Default value: None Accept pipeline input: False Accept wildcard characters: False ``` @@ -101,22 +101,37 @@ Aliases: Required: False Position: 6 -Default value: 0 +Default value: None Accept pipeline input: False Accept wildcard characters: False ``` -### -min_qty -Min quantity of the accessory before alert is triggered +### -min_amt +Minimum amount of the accessory, before alert is triggered ```yaml -Type: Boolean +Type: Int32 Parameter Sets: (All) Aliases: Required: False -Position: 10 -Default value: False +Position: 11 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -model_number +Model number for this accessory + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 7 +Default value: None Accept pipeline input: False Accept wildcard characters: False ``` @@ -145,7 +160,7 @@ Parameter Sets: (All) Aliases: Required: False -Position: 7 +Position: 8 Default value: None Accept pipeline input: False Accept wildcard characters: False @@ -160,7 +175,7 @@ Parameter Sets: (All) Aliases: Required: False -Position: 8 +Position: 9 Default value: 0 Accept pipeline input: False Accept wildcard characters: False @@ -175,7 +190,7 @@ Parameter Sets: (All) Aliases: Required: False -Position: 9 +Position: 10 Default value: None Accept pipeline input: False Accept wildcard characters: False @@ -205,8 +220,8 @@ Parameter Sets: (All) Aliases: Required: False -Position: 11 -Default value: 0 +Position: 12 +Default value: None Accept pipeline input: False Accept wildcard characters: False ``` @@ -220,7 +235,7 @@ Parameter Sets: (All) Aliases: Required: True -Position: 12 +Position: 13 Default value: None Accept pipeline input: False Accept wildcard characters: False diff --git a/docs/Set-SnipeitAsset.md b/docs/Set-SnipeitAsset.md index c715cb4..900e5da 100644 --- a/docs/Set-SnipeitAsset.md +++ b/docs/Set-SnipeitAsset.md @@ -84,7 +84,7 @@ Aliases: Required: False Position: 6 -Default value: 0 +Default value: None Accept pipeline input: False Accept wildcard characters: False ``` @@ -99,7 +99,7 @@ Aliases: Required: False Position: 7 -Default value: 0 +Default value: None Accept pipeline input: False Accept wildcard characters: False ``` @@ -280,7 +280,7 @@ Aliases: Required: False Position: 15 -Default value: 0 +Default value: None Accept pipeline input: False Accept wildcard characters: False ``` @@ -340,7 +340,7 @@ Aliases: Required: False Position: 10 -Default value: 0 +Default value: None Accept pipeline input: False Accept wildcard characters: False ``` diff --git a/docs/Set-SnipeitComponent.md b/docs/Set-SnipeitComponent.md index cbf0d06..69b6a50 100644 --- a/docs/Set-SnipeitComponent.md +++ b/docs/Set-SnipeitComponent.md @@ -13,9 +13,9 @@ Updates component ## SYNTAX ``` -Set-SnipeitComponent [-id] [-qty] [[-name] ] [[-company_id] ] - [[-location_id] ] [[-order_number] ] [[-purchase_date] ] [[-purchase_cost] ] - [-url] [-apiKey] [-WhatIf] [-Confirm] [] +Set-SnipeitComponent [-id] [-qty] [[-min_amt] ] [[-name] ] + [[-company_id] ] [[-location_id] ] [[-order_number] ] [[-purchase_date] ] + [[-purchase_cost] ] [-url] [-apiKey] [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -39,7 +39,7 @@ Parameter Sets: (All) Aliases: Required: True -Position: 10 +Position: 11 Default value: None Accept pipeline input: False Accept wildcard characters: False @@ -54,8 +54,8 @@ Parameter Sets: (All) Aliases: Required: False -Position: 4 -Default value: 0 +Position: 5 +Default value: None Accept pipeline input: False Accept wildcard characters: False ``` @@ -64,14 +64,14 @@ Accept wildcard characters: False ID number of name ```yaml -Type: Int32 +Type: Int32[] Parameter Sets: (All) Aliases: Required: True Position: 1 -Default value: 0 -Accept pipeline input: False +Default value: None +Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` @@ -84,8 +84,23 @@ Parameter Sets: (All) Aliases: Required: False -Position: 5 -Default value: 0 +Position: 6 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -min_amt +Minimum Quantity of the components before alert is triggered + +```yaml +Type: Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: 3 +Default value: None Accept pipeline input: False Accept wildcard characters: False ``` @@ -99,7 +114,7 @@ Parameter Sets: (All) Aliases: Required: False -Position: 3 +Position: 4 Default value: None Accept pipeline input: False Accept wildcard characters: False @@ -114,7 +129,7 @@ Parameter Sets: (All) Aliases: Required: False -Position: 6 +Position: 7 Default value: None Accept pipeline input: False Accept wildcard characters: False @@ -129,7 +144,7 @@ Parameter Sets: (All) Aliases: Required: False -Position: 8 +Position: 9 Default value: 0 Accept pipeline input: False Accept wildcard characters: False @@ -144,7 +159,7 @@ Parameter Sets: (All) Aliases: Required: False -Position: 7 +Position: 8 Default value: None Accept pipeline input: False Accept wildcard characters: False @@ -174,7 +189,7 @@ Parameter Sets: (All) Aliases: Required: True -Position: 9 +Position: 10 Default value: None Accept pipeline input: False Accept wildcard characters: False diff --git a/docs/Set-SnipeitConsumable.md b/docs/Set-SnipeitConsumable.md index cded8d2..2379254 100644 --- a/docs/Set-SnipeitConsumable.md +++ b/docs/Set-SnipeitConsumable.md @@ -73,7 +73,7 @@ Aliases: Required: False Position: 6 -Default value: 0 +Default value: None Accept pipeline input: False Accept wildcard characters: False ``` @@ -118,7 +118,7 @@ Aliases: Required: False Position: 9 -Default value: 0 +Default value: None Accept pipeline input: False Accept wildcard characters: False ``` @@ -133,7 +133,7 @@ Aliases: Required: False Position: 8 -Default value: 0 +Default value: None Accept pipeline input: False Accept wildcard characters: False ``` @@ -148,7 +148,7 @@ Aliases: Required: False Position: 5 -Default value: 0 +Default value: None Accept pipeline input: False Accept wildcard characters: False ``` diff --git a/docs/Set-SnipeitDepartment.md b/docs/Set-SnipeitDepartment.md index 0c0e0ae..c701fc9 100644 --- a/docs/Set-SnipeitDepartment.md +++ b/docs/Set-SnipeitDepartment.md @@ -55,7 +55,7 @@ Aliases: Required: False Position: 3 -Default value: 0 +Default value: None Accept pipeline input: False Accept wildcard characters: False ``` @@ -85,7 +85,7 @@ Aliases: Required: False Position: 4 -Default value: 0 +Default value: None Accept pipeline input: False Accept wildcard characters: False ``` @@ -100,7 +100,7 @@ Aliases: Required: False Position: 5 -Default value: 0 +Default value: None Accept pipeline input: False Accept wildcard characters: False ``` diff --git a/docs/Set-SnipeitLicense.md b/docs/Set-SnipeitLicense.md index 4e20e67..8730895 100644 --- a/docs/Set-SnipeitLicense.md +++ b/docs/Set-SnipeitLicense.md @@ -73,7 +73,7 @@ Aliases: Required: False Position: 5 -Default value: 0 +Default value: None Accept pipeline input: False Accept wildcard characters: False ``` @@ -298,7 +298,7 @@ Aliases: Required: False Position: 17 -Default value: 0 +Default value: None Accept pipeline input: False Accept wildcard characters: False ``` diff --git a/docs/Set-SnipeitLicenseSeat.md b/docs/Set-SnipeitLicenseSeat.md index 96280e9..7f53a74 100644 --- a/docs/Set-SnipeitLicenseSeat.md +++ b/docs/Set-SnipeitLicenseSeat.md @@ -24,16 +24,22 @@ Checkout specific license seat to user, asset or both ### EXAMPLE 1 ``` -Set-SnipeitLicenceSeat -ID 1 -seat_id 1 -assigned_id 3 -Verbose +Set-SnipeitLicenceSeat -ID 1 -seat_id 1 -assigned_id 3 Checkout licence to user id 3 ``` ### EXAMPLE 2 ``` -Set-SnipeitLicenceSeat -ID 1 -seat_id 1 -asset_id 3 -Verbose +Set-SnipeitLicenceSeat -ID 1 -seat_id 1 -asset_id 3 Checkout licence to asset id 3 ``` +### EXAMPLE 3 +``` +Set-SnipeitLicenceSeat -ID 1 -seat_id 1 -asset_id $null -assigned_id $null +Checkin licence seat id 1 of licence id 1 +``` + ## PARAMETERS ### -apiKey @@ -61,7 +67,7 @@ Aliases: Required: False Position: 4 -Default value: 0 +Default value: None Accept pipeline input: False Accept wildcard characters: False ``` @@ -76,7 +82,7 @@ Aliases: assigned_id Required: False Position: 3 -Default value: 0 +Default value: None Accept pipeline input: False Accept wildcard characters: False ``` diff --git a/docs/Set-SnipeitLocation.md b/docs/Set-SnipeitLocation.md index d4f5925..f1fa607 100644 --- a/docs/Set-SnipeitLocation.md +++ b/docs/Set-SnipeitLocation.md @@ -161,7 +161,7 @@ Aliases: Required: False Position: 10 -Default value: 0 +Default value: None Accept pipeline input: False Accept wildcard characters: False ``` @@ -191,7 +191,7 @@ Aliases: Required: False Position: 12 -Default value: 0 +Default value: None Accept pipeline input: False Accept wildcard characters: False ``` diff --git a/docs/Set-SnipeitModel.md b/docs/Set-SnipeitModel.md index 640eb6e..9397c5e 100644 --- a/docs/Set-SnipeitModel.md +++ b/docs/Set-SnipeitModel.md @@ -70,7 +70,7 @@ Aliases: fieldset_id Required: False Position: 7 -Default value: 0 +Default value: None Accept pipeline input: False Accept wildcard characters: False ``` @@ -85,7 +85,7 @@ Aliases: Required: False Position: 6 -Default value: 0 +Default value: None Accept pipeline input: False Accept wildcard characters: False ``` diff --git a/docs/Set-SnipeitUser.md b/docs/Set-SnipeitUser.md index 4d5faa0..1e52ef2 100644 --- a/docs/Set-SnipeitUser.md +++ b/docs/Set-SnipeitUser.md @@ -14,7 +14,7 @@ Creates a new user ``` Set-SnipeitUser [-id] [[-first_name] ] [[-last_name] ] [[-userName] ] - [[-jobtitle] ] [[-email] ] [[-phone] ] [[-company_id] ] + [[-jobtitle] ] [[-email] ] [[-phone] ] [[-password] ] [[-company_id] ] [[-location_id] ] [[-department_id] ] [[-manager_id] ] [[-employee_num] ] [[-activated] ] [[-notes] ] [-url] [-apiKey] [-WhatIf] [-Confirm] [] @@ -42,7 +42,7 @@ Parameter Sets: (All) Aliases: Required: False -Position: 13 +Position: 14 Default value: False Accept pipeline input: False Accept wildcard characters: False @@ -57,7 +57,7 @@ Parameter Sets: (All) Aliases: Required: True -Position: 16 +Position: 17 Default value: None Accept pipeline input: False Accept wildcard characters: False @@ -72,8 +72,8 @@ Parameter Sets: (All) Aliases: Required: False -Position: 8 -Default value: 0 +Position: 9 +Default value: None Accept pipeline input: False Accept wildcard characters: False ``` @@ -87,8 +87,8 @@ Parameter Sets: (All) Aliases: Required: False -Position: 10 -Default value: 0 +Position: 11 +Default value: None Accept pipeline input: False Accept wildcard characters: False ``` @@ -117,7 +117,7 @@ Parameter Sets: (All) Aliases: Required: False -Position: 12 +Position: 13 Default value: None Accept pipeline input: False Accept wildcard characters: False @@ -192,8 +192,8 @@ Parameter Sets: (All) Aliases: Required: False -Position: 9 -Default value: 0 +Position: 10 +Default value: None Accept pipeline input: False Accept wildcard characters: False ``` @@ -207,8 +207,8 @@ Parameter Sets: (All) Aliases: Required: False -Position: 11 -Default value: 0 +Position: 12 +Default value: None Accept pipeline input: False Accept wildcard characters: False ``` @@ -222,7 +222,22 @@ Parameter Sets: (All) Aliases: Required: False -Position: 14 +Position: 15 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -password +Password for user + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 8 Default value: None Accept pipeline input: False Accept wildcard characters: False @@ -252,7 +267,7 @@ Parameter Sets: (All) Aliases: Required: True -Position: 15 +Position: 16 Default value: None Accept pipeline input: False Accept wildcard characters: False