Merge pull request #189 from snazy2000/develop

Release 1.8
This commit is contained in:
Petri Asikainen 2021-06-17 16:00:29 +03:00 committed by GitHub
commit 9bfa4173de
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 369 additions and 69 deletions

View file

@ -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/), The format is based on [Keep a Changelog](http://keepachangelog.com/),
and this project adheres to [Semantic Versioning](http://semver.org/). 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 # [v.1.7.x] - 2021-06-14
## Consumables ## Consumables

View file

@ -32,6 +32,10 @@ Get-SnipeitAccessory -search Keyboard
.EXAMPLE .EXAMPLE
Get-SnipeitAccessory -id 1 Get-SnipeitAccessory -id 1
.EXAMPLE
Get-SnipeitAccessory -user_id 1
Get accessories checked out to user ID 1
#> #>
function Get-SnipeitAccessory() { function Get-SnipeitAccessory() {
@ -43,6 +47,9 @@ function Get-SnipeitAccessory() {
[parameter(ParameterSetName='Get by ID')] [parameter(ParameterSetName='Get by ID')]
[int]$id, [int]$id,
[parameter(ParameterSetName='Accessories checked out to user id')]
[int]$user_id,
[parameter(ParameterSetName='Search')] [parameter(ParameterSetName='Search')]
[int]$company_id, [int]$company_id,
@ -69,6 +76,7 @@ function Get-SnipeitAccessory() {
[int]$offset, [int]$offset,
[parameter(ParameterSetName='Search')] [parameter(ParameterSetName='Search')]
[parameter(ParameterSetName='Accessories checked out to user id')]
[switch]$all = $false, [switch]$all = $false,
[parameter(mandatory = $true)] [parameter(mandatory = $true)]
@ -79,23 +87,21 @@ function Get-SnipeitAccessory() {
) )
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
if ($id -and $search){ switch($PsCmdlet.ParameterSetName) {
throw "Please specify only one of -id or -search parameter" '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 $SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
$Parameters = @{ $Parameters = @{
Uri = "$url/api/v1/accessories" Uri = $apiurl
Method = 'Get' Method = 'Get'
GetParameters = $SearchParameter GetParameters = $SearchParameter
Token = $apiKey Token = $apiKey
} }
if($id){
$Parameters.Uri ="$url/api/v1/accessories/$id"
}
if ($all) { if ($all) {
$offstart = $(if($offset){$offset} Else {0}) $offstart = $(if($offset){$offset} Else {0})
$callargs = $SearchParameter $callargs = $SearchParameter

View file

@ -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 Users API Key for Snipeit, can be set using Set-SnipeitInfo command
.EXAMPLE .EXAMPLE
Get-SnipeitAsset -url "https://assets.example.com"-token "token..." Get-SnipeitAsset -all -url "https://assets.example.com"-token "token..."
Returens all assets
.EXAMPLE .EXAMPLE
Get-SnipeitAsset -search "myMachine"-url "https://assets.example.com"-token "token..." Get-SnipeitAsset -search "myMachine"
Search for specific asset
.EXAMPLE .EXAMPLE
Get-SnipeitAsset -search "myMachine"-url "https://assets.example.com"-token "token..." Get-SnipeitAsset -id 3
Get asset with id number 3
.EXAMPLE .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() { function Get-SnipeitAsset() {
@ -100,6 +126,12 @@ function Get-SnipeitAsset() {
[parameter(ParameterSetName='Assets overdue for auditing')] [parameter(ParameterSetName='Assets overdue for auditing')]
[switch]$audit_overdue, [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')] [parameter(ParameterSetName='Search')]
[string]$order_number, [string]$order_number,
@ -133,28 +165,38 @@ function Get-SnipeitAsset() {
[parameter(ParameterSetName='Search')] [parameter(ParameterSetName='Search')]
[parameter(ParameterSetName='Assets due auditing soon')] [parameter(ParameterSetName='Assets due auditing soon')]
[parameter(ParameterSetName='Assets overdue for auditing')] [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')] [ValidateSet('id','created_at','asset_tag','serial','order_number','model_id','category_id','manufacturer_id','company_id','location_id','status','status_id')]
[string]$sort, [string]$sort,
[parameter(ParameterSetName='Search')] [parameter(ParameterSetName='Search')]
[parameter(ParameterSetName='Assets due auditing soon')] [parameter(ParameterSetName='Assets due auditing soon')]
[parameter(ParameterSetName='Assets overdue for auditing')] [parameter(ParameterSetName='Assets overdue for auditing')]
[parameter(ParameterSetName='Assets checked out to user id')]
[parameter(ParameterSetName='Assets with component id')]
[ValidateSet("asc", "desc")] [ValidateSet("asc", "desc")]
[string]$order, [string]$order,
[parameter(ParameterSetName='Search')] [parameter(ParameterSetName='Search')]
[parameter(ParameterSetName='Assets due auditing soon')] [parameter(ParameterSetName='Assets due auditing soon')]
[parameter(ParameterSetName='Assets overdue for auditing')] [parameter(ParameterSetName='Assets overdue for auditing')]
[parameter(ParameterSetName='Assets checked out to user id')]
[parameter(ParameterSetName='Assets with component id')]
[int]$limit = 50, [int]$limit = 50,
[parameter(ParameterSetName='Search')] [parameter(ParameterSetName='Search')]
[parameter(ParameterSetName='Assets due auditing soon')] [parameter(ParameterSetName='Assets due auditing soon')]
[parameter(ParameterSetName='Assets overdue for auditing')] [parameter(ParameterSetName='Assets overdue for auditing')]
[parameter(ParameterSetName='Assets checked out to user id')]
[parameter(ParameterSetName='Assets with component id')]
[int]$offset, [int]$offset,
[parameter(ParameterSetName='Search')] [parameter(ParameterSetName='Search')]
[parameter(ParameterSetName='Assets due auditing soon')] [parameter(ParameterSetName='Assets due auditing soon')]
[parameter(ParameterSetName='Assets overdue for auditing')] [parameter(ParameterSetName='Assets overdue for auditing')]
[parameter(ParameterSetName='Assets checked out to user id')]
[parameter(ParameterSetName='Assets with component id')]
[switch]$all = $false, [switch]$all = $false,
[parameter(mandatory = $true)] [parameter(mandatory = $true)]
@ -175,6 +217,8 @@ function Get-SnipeitAsset() {
'Get with serial' { $apiurl= "$url/api/v1/hardware/byserial/$serial"} 'Get with serial' { $apiurl= "$url/api/v1/hardware/byserial/$serial"}
'Assets due auditing soon' {$apiurl = "$url/api/v1/hardware/audit/due"} 'Assets due auditing soon' {$apiurl = "$url/api/v1/hardware/audit/due"}
'Assets overdue for auditing' {$apiurl = "$url/api/v1/hardware/audit/overdue"} '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"}
} }

View file

@ -41,6 +41,12 @@ function Get-SnipeitLicense() {
[parameter(ParameterSetName='Get with ID')] [parameter(ParameterSetName='Get with ID')]
[int]$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')] [parameter(ParameterSetName='Search')]
[string]$name, [string]$name,
@ -87,7 +93,8 @@ function Get-SnipeitLicense() {
[parameter(ParameterSetName='Search')] [parameter(ParameterSetName='Search')]
[int]$offset, [int]$offset,
[parameter(ParameterSetName='Get licenses checked out to user ID')]
[parameter(ParameterSetName='Get licenses checked out to asset ID')]
[parameter(ParameterSetName='Search')] [parameter(ParameterSetName='Search')]
[switch]$all = $false, [switch]$all = $false,
@ -102,14 +109,11 @@ function Get-SnipeitLicense() {
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters $SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
$apiurl = "$url/api/v1/licenses" switch($PsCmdlet.ParameterSetName) {
'Search' {$apiurl = "$url/api/v1/licenses"}
if ($search -and $id ) { 'Get with ID' {$apiurl= "$url/api/v1/licenses/$id"}
Throw "[$($MyInvocation.MyCommand.Name)] Please specify only -search or -id parameter , not both " '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"}
if ($id) {
$apiurl= "$url/api/v1/licenses/$id"
} }
$Parameters = @{ $Parameters = @{

View file

@ -40,6 +40,10 @@ Get-SnipeitUser -username someuser
.EXAMPLE .EXAMPLE
Get-SnipeitUser -email user@somedomain.com 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() { function Get-SnipeitUser() {
@ -51,6 +55,9 @@ function Get-SnipeitUser() {
[parameter(ParameterSetName='Get with ID')] [parameter(ParameterSetName='Get with ID')]
[string]$id, [string]$id,
[parameter(ParameterSetName='Get users a specific accessory id has been checked out to')]
[string]$accessory_id,
[parameter(ParameterSetName='Search')] [parameter(ParameterSetName='Search')]
[int]$company_id, [int]$company_id,
@ -80,6 +87,7 @@ function Get-SnipeitUser() {
[int]$offset, [int]$offset,
[parameter(ParameterSetName='Search')] [parameter(ParameterSetName='Search')]
[parameter(ParameterSetName='Get users a specific accessory id has been checked out to')]
[switch]$all = $false, [switch]$all = $false,
[parameter(mandatory = $true)] [parameter(mandatory = $true)]
@ -92,16 +100,12 @@ function Get-SnipeitUser() {
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters $SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
switch ($PsCmdlet.ParameterSetName) {
$apiurl = "$url/api/v1/users" 'Search' { $apiurl = "$url/api/v1/users"}
'Get with id' {$apiurl= "$url/api/v1/users/$id"}
if ($search -and $id ) { 'Get users a specific accessory id has been checked out to' {$apiurl= "$url/api/v1/accessories/$accessory_id/checkedout"}
Throw "[$($MyInvocation.MyCommand.Name)] Please specify only -search or -id parameter , not both "
} }
if ($id) {
$apiurl= "$url/api/v1/users/$id"
}
$Parameters = @{ $Parameters = @{
Uri = $apiurl Uri = $apiurl
Method = 'Get' Method = 'Get'

View file

@ -23,6 +23,9 @@ ID Number of the company the accessory is assigned to
.PARAMETER manufacturer_id .PARAMETER manufacturer_id
ID number of the manufacturer for this accessory. ID number of the manufacturer for this accessory.
.PARAMETER model_number
Model number for this accessory
.PARAMETER order_number .PARAMETER order_number
Order number for this accessory. Order number for this accessory.
@ -47,7 +50,7 @@ ID number of the supplier for this accessory
.PARAMETER location_id .PARAMETER location_id
ID number of the location the accessory is assigned to 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 Min quantity of the accessory before alert is triggered
.PARAMETER url .PARAMETER url
@ -86,11 +89,13 @@ function New-SnipeitAccessory() {
[string]$order_number, [string]$order_number,
[string]$model_number,
[float]$purchase_cost, [float]$purchase_cost,
[datetime]$purchase_date, [datetime]$purchase_date,
[int]$min_qty, [int]$min_amt,
[ValidateRange(1, [int]::MaxValue)] [ValidateRange(1, [int]::MaxValue)]
[int]$supplier_id, [int]$supplier_id,

View file

@ -26,6 +26,9 @@ ID Number of the company the accessory is assigned to
.PARAMETER manufacturer_id .PARAMETER manufacturer_id
ID number of the manufacturer for this accessory. ID number of the manufacturer for this accessory.
.PARAMETER model_number
Model number for this accessory
.PARAMETER order_number .PARAMETER order_number
Order number for this accessory. Order number for this accessory.
@ -85,6 +88,7 @@ function Set-SnipeitAccessory() {
[Nullable[System.Int32]]$manufacturer_id, [Nullable[System.Int32]]$manufacturer_id,
[string]$model_number,
[string]$order_number, [string]$order_number,
@ -120,7 +124,7 @@ function Set-SnipeitAccessory() {
foreach($accessory_id in $id){ foreach($accessory_id in $id){
$Parameters = @{ $Parameters = @{
Uri = "$url/api/v1/accessories/$accessory_id" Uri = "$url/api/v1/accessories/$accessory_id"
Method = 'Patch' Method = 'Put'
Body = $Body Body = $Body
Token = $apiKey Token = $apiKey
} }

View file

@ -23,13 +23,17 @@
User's API Key for Snipeit, can be set using Set-SnipeitInfo command User's API Key for Snipeit, can be set using Set-SnipeitInfo command
.EXAMPLE .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 Checkout licence to user id 3
.EXAMPLE .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 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() function Set-SnipeitLicenseSeat()
{ {

View file

@ -12,7 +12,7 @@
RootModule = 'SnipeitPS' RootModule = 'SnipeitPS'
# Version number of this module. # Version number of this module.
ModuleVersion = '1.7' ModuleVersion = '1.8'
# Supported PSEditions # Supported PSEditions
# CompatiblePSEditions = @() # CompatiblePSEditions = @()

View file

@ -17,7 +17,7 @@ environment:
secure: UdM6qhf5B0G8liHhUrwWERCZr44iSqmg4jUq0lwlTjZs4KyeoiwnBzdej0phqIAm secure: UdM6qhf5B0G8liHhUrwWERCZr44iSqmg4jUq0lwlTjZs4KyeoiwnBzdej0phqIAm
PShell: '5' PShell: '5'
version: 1.7.{build} version: 1.8.{build}
# Don't rebuild when I tag a release on GitHub # Don't rebuild when I tag a release on GitHub
skip_tags: true skip_tags: true

View file

@ -24,6 +24,11 @@ Get-SnipeitAccessory [-search <String>] [-company_id <Int32>] [-category_id <Int
Get-SnipeitAccessory [-id <Int32>] -url <String> -apiKey <String> [<CommonParameters>] Get-SnipeitAccessory [-id <Int32>] -url <String> -apiKey <String> [<CommonParameters>]
``` ```
### Accessories checked out to user id
```
Get-SnipeitAccessory [-user_id <Int32>] [-all] -url <String> -apiKey <String> [<CommonParameters>]
```
## DESCRIPTION ## DESCRIPTION
Gets a list of Snipe-it Accessories Gets a list of Snipe-it Accessories
@ -39,6 +44,12 @@ Get-SnipeitAccessory -search Keyboard
Get-SnipeitAccessory -id 1 Get-SnipeitAccessory -id 1
``` ```
### EXAMPLE 3
```
Get-SnipeitAccessory -user_id 1
Get accessories checked out to user ID 1
```
## PARAMETERS ## PARAMETERS
### -all ### -all
@ -46,7 +57,7 @@ A return all results, works with -offset and other parameters
```yaml ```yaml
Type: SwitchParameter Type: SwitchParameter
Parameter Sets: Search Parameter Sets: Search, Accessories checked out to user id
Aliases: Aliases:
Required: False Required: False
@ -238,6 +249,21 @@ Accept pipeline input: False
Accept wildcard characters: 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 ### 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). 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).

View file

@ -47,6 +47,18 @@ Get-SnipeitAsset [-audit_overdue] [-sort <String>] [-order <String>] [-limit <In
-url <String> -apiKey <String> [<CommonParameters>] -url <String> -apiKey <String> [<CommonParameters>]
``` ```
### Assets checked out to user id
```
Get-SnipeitAsset [-user_id <Int32>] [-sort <String>] [-order <String>] [-limit <Int32>] [-offset <Int32>]
[-all] -url <String> -apiKey <String> [<CommonParameters>]
```
### Assets with component id
```
Get-SnipeitAsset [-component_id <Int32>] [-sort <String>] [-order <String>] [-limit <Int32>] [-offset <Int32>]
[-all] -url <String> -apiKey <String> [<CommonParameters>]
```
## DESCRIPTION ## DESCRIPTION
{{ Fill in the Description }} {{ Fill in the Description }}
@ -54,22 +66,56 @@ Get-SnipeitAsset [-audit_overdue] [-sort <String>] [-order <String>] [-limit <In
### EXAMPLE 1 ### EXAMPLE 1
``` ```
Get-SnipeitAsset -url "https://assets.example.com"-token "token..." Get-SnipeitAsset -all -url "https://assets.example.com"-token "token..."
Returens all assets
``` ```
### EXAMPLE 2 ### EXAMPLE 2
``` ```
Get-SnipeitAsset -search "myMachine"-url "https://assets.example.com"-token "token..." Get-SnipeitAsset -search "myMachine"
Search for specific asset
``` ```
### EXAMPLE 3 ### EXAMPLE 3
``` ```
Get-SnipeitAsset -search "myMachine"-url "https://assets.example.com"-token "token..." Get-SnipeitAsset -id 3
Get asset with id number 3
``` ```
### EXAMPLE 4 ### EXAMPLE 4
``` ```
Get-SnipeitAsset -asset_tag "myAssetTag"-url "https://assets.example.com"-token "token..." Get-SnipeitAsset -asset_tag snipe0003
Get asset with asset tag snipe00033
```
### EXAMPLE 5
```
Get-SnipeitAsset -serial 1234
Get asset with searial number 1234
```
### EXAMPLE 6
```
Get-SnipeitAsser -audit_due
Get Assets due auditing soon
```
### EXAMPLE 7
```
Get-SnipeitAsser -audit_overdue
Get Assets overdue for auditing
```
### EXAMPLE 8
```
Get-AnipeitAsset -user_id 4
Get Assets checked out to user id 4
```
### EXAMPLE 9
```
Get-SnipeitAsset -component_id 5
Get Assets with component id 5
``` ```
## PARAMETERS ## PARAMETERS
@ -79,7 +125,7 @@ A return all results, works with -offset and other parameters
```yaml ```yaml
Type: SwitchParameter Type: SwitchParameter
Parameter Sets: Search, Assets due auditing soon, Assets overdue for auditing Parameter Sets: Search, Assets due auditing soon, Assets overdue for auditing, Assets checked out to user id, Assets with component id
Aliases: Aliases:
Required: False Required: False
@ -179,6 +225,21 @@ Accept pipeline input: False
Accept wildcard characters: False Accept wildcard characters: False
``` ```
### -component_id
{{ Fill component_id Description }}
```yaml
Type: Int32
Parameter Sets: Assets with component id
Aliases:
Required: False
Position: Named
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False
```
### -depreciation_id ### -depreciation_id
{{ Fill depreciation_id Description }} {{ Fill depreciation_id Description }}
@ -216,7 +277,7 @@ Defines batch size for -all
```yaml ```yaml
Type: Int32 Type: Int32
Parameter Sets: Search, Assets due auditing soon, Assets overdue for auditing Parameter Sets: Search, Assets due auditing soon, Assets overdue for auditing, Assets checked out to user id, Assets with component id
Aliases: Aliases:
Required: False Required: False
@ -276,7 +337,7 @@ Offset to use
```yaml ```yaml
Type: Int32 Type: Int32
Parameter Sets: Search, Assets due auditing soon, Assets overdue for auditing Parameter Sets: Search, Assets due auditing soon, Assets overdue for auditing, Assets checked out to user id, Assets with component id
Aliases: Aliases:
Required: False Required: False
@ -291,7 +352,7 @@ Specify the order (asc or desc) you wish to order by on your sort column
```yaml ```yaml
Type: String Type: String
Parameter Sets: Search, Assets due auditing soon, Assets overdue for auditing Parameter Sets: Search, Assets due auditing soon, Assets overdue for auditing, Assets checked out to user id, Assets with component id
Aliases: Aliases:
Required: False Required: False
@ -366,7 +427,7 @@ Specify the column name you wish to sort by
```yaml ```yaml
Type: String Type: String
Parameter Sets: Search, Assets due auditing soon, Assets overdue for auditing Parameter Sets: Search, Assets due auditing soon, Assets overdue for auditing, Assets checked out to user id, Assets with component id
Aliases: Aliases:
Required: False Required: False
@ -421,6 +482,21 @@ Accept pipeline input: False
Accept wildcard characters: False Accept wildcard characters: False
``` ```
### -user_id
{{ Fill user_id Description }}
```yaml
Type: Int32
Parameter Sets: Assets checked out to user id
Aliases:
Required: False
Position: Named
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False
```
### CommonParameters ### 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). 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).

View file

@ -26,6 +26,16 @@ Get-SnipeitLicense [-search <String>] [-name <String>] [-company_id <Int32>] [-p
Get-SnipeitLicense [-id <Int32>] -url <String> -apiKey <String> [<CommonParameters>] Get-SnipeitLicense [-id <Int32>] -url <String> -apiKey <String> [<CommonParameters>]
``` ```
### Get licenses checked out to user ID
```
Get-SnipeitLicense [-user_id <Int32>] [-all] -url <String> -apiKey <String> [<CommonParameters>]
```
### Get licenses checked out to asset ID
```
Get-SnipeitLicense [-asset_id <Int32>] [-all] -url <String> -apiKey <String> [<CommonParameters>]
```
## DESCRIPTION ## DESCRIPTION
{{ Fill in the Description }} {{ Fill in the Description }}
@ -48,7 +58,7 @@ A return all results, works with -offset and other parameters
```yaml ```yaml
Type: SwitchParameter Type: SwitchParameter
Parameter Sets: Search Parameter Sets: Search, Get licenses checked out to user ID, Get licenses checked out to asset ID
Aliases: Aliases:
Required: False Required: False
@ -73,6 +83,21 @@ Accept pipeline input: False
Accept wildcard characters: 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 ### -category_id
{{ Fill category_id Description }} {{ Fill category_id Description }}
@ -345,6 +370,21 @@ Accept pipeline input: False
Accept wildcard characters: 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 ### 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). 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).

View file

@ -24,6 +24,11 @@ Get-SnipeitUser [-search <String>] [-company_id <Int32>] [-location_id <Int32>]
Get-SnipeitUser [-id <String>] -url <String> -apiKey <String> [<CommonParameters>] Get-SnipeitUser [-id <String>] -url <String> -apiKey <String> [<CommonParameters>]
``` ```
### Get users a specific accessory id has been checked out to
```
Get-SnipeitUser [-accessory_id <String>] [-all] -url <String> -apiKey <String> [<CommonParameters>]
```
## DESCRIPTION ## DESCRIPTION
{{ Fill in the Description }} {{ Fill in the Description }}
@ -49,14 +54,35 @@ Get-SnipeitUser -username someuser
Get-SnipeitUser -email user@somedomain.com 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 ## 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 ### -all
A return all results, works with -offset and other parameters A return all results, works with -offset and other parameters
```yaml ```yaml
Type: SwitchParameter Type: SwitchParameter
Parameter Sets: Search Parameter Sets: Search, Get users a specific accessory id has been checked out to
Aliases: Aliases:
Required: False Required: False

View file

@ -14,8 +14,8 @@ Creates new accessory on Snipe-It system
``` ```
New-SnipeitAccessory [-name] <String> [-qty] <Int32> [-category_id] <Int32> [[-company_id] <Int32>] New-SnipeitAccessory [-name] <String> [-qty] <Int32> [-category_id] <Int32> [[-company_id] <Int32>]
[[-manufacturer_id] <Int32>] [[-order_number] <String>] [[-purchase_cost] <Single>] [[-manufacturer_id] <Int32>] [[-order_number] <String>] [[-model_number] <String>] [[-purchase_cost] <Single>]
[[-purchase_date] <DateTime>] [[-min_qty] <Int32>] [[-supplier_id] <Int32>] [[-location_id] <Int32>] [[-purchase_date] <DateTime>] [[-min_amt] <Int32>] [[-supplier_id] <Int32>] [[-location_id] <Int32>]
[-url] <String> [-apiKey] <String> [-WhatIf] [-Confirm] [<CommonParameters>] [-url] <String> [-apiKey] <String> [-WhatIf] [-Confirm] [<CommonParameters>]
``` ```
@ -40,7 +40,7 @@ Parameter Sets: (All)
Aliases: Aliases:
Required: True Required: True
Position: 13 Position: 14
Default value: None Default value: None
Accept pipeline input: False Accept pipeline input: False
Accept wildcard characters: False Accept wildcard characters: False
@ -85,7 +85,7 @@ Parameter Sets: (All)
Aliases: Aliases:
Required: False Required: False
Position: 11 Position: 12
Default value: 0 Default value: 0
Accept pipeline input: False Accept pipeline input: False
Accept wildcard characters: False Accept wildcard characters: False
@ -106,7 +106,7 @@ Accept pipeline input: False
Accept wildcard characters: False Accept wildcard characters: False
``` ```
### -min_qty ### -min_amt
Min quantity of the accessory before alert is triggered Min quantity of the accessory before alert is triggered
```yaml ```yaml
@ -115,12 +115,27 @@ Parameter Sets: (All)
Aliases: Aliases:
Required: False Required: False
Position: 9 Position: 10
Default value: 0 Default value: 0
Accept pipeline input: False Accept pipeline input: False
Accept wildcard characters: 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 ### -name
Accessory name Accessory name
@ -160,7 +175,7 @@ Parameter Sets: (All)
Aliases: Aliases:
Required: False Required: False
Position: 7 Position: 8
Default value: 0 Default value: 0
Accept pipeline input: False Accept pipeline input: False
Accept wildcard characters: False Accept wildcard characters: False
@ -175,7 +190,7 @@ Parameter Sets: (All)
Aliases: Aliases:
Required: False Required: False
Position: 8 Position: 9
Default value: None Default value: None
Accept pipeline input: False Accept pipeline input: False
Accept wildcard characters: False Accept wildcard characters: False
@ -205,7 +220,7 @@ Parameter Sets: (All)
Aliases: Aliases:
Required: False Required: False
Position: 10 Position: 11
Default value: 0 Default value: 0
Accept pipeline input: False Accept pipeline input: False
Accept wildcard characters: False Accept wildcard characters: False
@ -220,7 +235,7 @@ Parameter Sets: (All)
Aliases: Aliases:
Required: True Required: True
Position: 12 Position: 13
Default value: None Default value: None
Accept pipeline input: False Accept pipeline input: False
Accept wildcard characters: False Accept wildcard characters: False

View file

@ -14,9 +14,9 @@ Updates accessory on Snipe-It system
``` ```
Set-SnipeitAccessory [-id] <Int32[]> [[-name] <String>] [[-qty] <Int32>] [[-category_id] <Int32>] Set-SnipeitAccessory [-id] <Int32[]> [[-name] <String>] [[-qty] <Int32>] [[-category_id] <Int32>]
[[-company_id] <Int32>] [[-manufacturer_id] <Int32>] [[-order_number] <String>] [[-purchase_cost] <Single>] [[-company_id] <Int32>] [[-manufacturer_id] <Int32>] [[-model_number] <String>] [[-order_number] <String>]
[[-purchase_date] <DateTime>] [[-min_amt] <Int32>] [[-supplier_id] <Int32>] [-url] <String> [-apiKey] <String> [[-purchase_cost] <Single>] [[-purchase_date] <DateTime>] [[-min_amt] <Int32>] [[-supplier_id] <Int32>]
[-WhatIf] [-Confirm] [<CommonParameters>] [-url] <String> [-apiKey] <String> [-WhatIf] [-Confirm] [<CommonParameters>]
``` ```
## DESCRIPTION ## DESCRIPTION
@ -40,7 +40,7 @@ Parameter Sets: (All)
Aliases: Aliases:
Required: True Required: True
Position: 13 Position: 14
Default value: None Default value: None
Accept pipeline input: False Accept pipeline input: False
Accept wildcard characters: False Accept wildcard characters: False
@ -115,7 +115,22 @@ Parameter Sets: (All)
Aliases: Aliases:
Required: False Required: False
Position: 10 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 Default value: None
Accept pipeline input: False Accept pipeline input: False
Accept wildcard characters: False Accept wildcard characters: False
@ -145,7 +160,7 @@ Parameter Sets: (All)
Aliases: Aliases:
Required: False Required: False
Position: 7 Position: 8
Default value: None Default value: None
Accept pipeline input: False Accept pipeline input: False
Accept wildcard characters: False Accept wildcard characters: False
@ -160,7 +175,7 @@ Parameter Sets: (All)
Aliases: Aliases:
Required: False Required: False
Position: 8 Position: 9
Default value: 0 Default value: 0
Accept pipeline input: False Accept pipeline input: False
Accept wildcard characters: False Accept wildcard characters: False
@ -175,7 +190,7 @@ Parameter Sets: (All)
Aliases: Aliases:
Required: False Required: False
Position: 9 Position: 10
Default value: None Default value: None
Accept pipeline input: False Accept pipeline input: False
Accept wildcard characters: False Accept wildcard characters: False
@ -205,7 +220,7 @@ Parameter Sets: (All)
Aliases: Aliases:
Required: False Required: False
Position: 11 Position: 12
Default value: None Default value: None
Accept pipeline input: False Accept pipeline input: False
Accept wildcard characters: False Accept wildcard characters: False
@ -220,7 +235,7 @@ Parameter Sets: (All)
Aliases: Aliases:
Required: True Required: True
Position: 12 Position: 13
Default value: None Default value: None
Accept pipeline input: False Accept pipeline input: False
Accept wildcard characters: False Accept wildcard characters: False

View file

@ -24,16 +24,22 @@ Checkout specific license seat to user, asset or both
### EXAMPLE 1 ### 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 Checkout licence to user id 3
``` ```
### EXAMPLE 2 ### 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 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 ## PARAMETERS
### -apiKey ### -apiKey