Merge pull request #129 from snazy2000/develop

Publish version 1.3
This commit is contained in:
Petri Asikainen 2021-05-27 15:53:10 +03:00 committed by GitHub
commit 1742db7f5e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 802 additions and 117 deletions

View file

@ -5,6 +5,23 @@ 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/).
# [v1.3.x] - 2021-05-27
## Checking out accessories
### New features
You can specify Put or Patch for Set-SnipeItAsset when updating assets.
Set-SnipeItLocation new -city parameter
### New Functions
- Set-SnipeItAccessoryOwner checkout accessory
- Get-SnipeItAccessoryOwner list checkedout accessories
- Reset-SnipeItAccessoryOwner checkin accessory
### Fixes
- Set-SnipeItAsset fixed datetime and name inputs #126,128
-
# [v1.2.x] - 2021-05-24 # [v1.2.x] - 2021-05-24
## Prefixing SnipeItPS ## Prefixing SnipeItPS

View file

@ -85,26 +85,32 @@
Write-Verbose $webResponse.Content Write-Verbose $webResponse.Content
# API returned a Content: lets work wit it # API returned a Content: lets work wit it
$response = ConvertFrom-Json -InputObject $webResponse.Content try{
$response = ConvertFrom-Json -InputObject $webResponse.Content
if ($response.status -eq "error") { if ($response.status -eq "error") {
Write-Verbose "[$($MyInvocation.MyCommand.Name)] An error response was received from; resolving" Write-Verbose "[$($MyInvocation.MyCommand.Name)] An error response was received from; resolving"
# This could be handled nicely in an function such as: # This could be handled nicely in an function such as:
# ResolveError $response -WriteError # ResolveError $response -WriteError
Write-Error $($response.messages | Out-String) Write-Error $($response.messages | Out-String)
}
else {
$result = $response
if (($response) -and ($response | Get-Member -Name payload))
{
$result = $response.payload
}
elseif (($response) -and ($response | Get-Member -Name rows)) {
$result = $response.rows
} }
else {
$result = $response
if (($response) -and ($response | Get-Member -Name payload))
{
$result = $response.payload
}
elseif (($response) -and ($response | Get-Member -Name rows)) {
$result = $response.rows
}
$result $result
}
} }
catch {
Write-Warning "Cannot parse server response. To debug try to add -Verbose with command."
}
} }
elseif ($webResponse.StatusCode -eq "Unauthorized") { elseif ($webResponse.StatusCode -eq "Unauthorized") {
Write-Error "[$($MyInvocation.MyCommand.Name)] You are not Authorized to access the resource, check your token is correct" Write-Error "[$($MyInvocation.MyCommand.Name)] You are not Authorized to access the resource, check your token is correct"

View file

@ -0,0 +1,49 @@
<#
.SYNOPSIS
Get list of checked out accessories
.DESCRIPTION
Get list of checked out accessories
.PARAMETER id
Unique ID For accessory to list
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeItInfo command
.PARAMETER apiKey
User's API Key for Snipeit, can be set using Set-SnipeItInfo command
.EXAMPLE
Get-SnipeItAccessoryOwner -id 1
#>
function Get-SnipeItAccessoryOwner()
{
[CmdletBinding(
SupportsShouldProcess = $true,
ConfirmImpact = "Medium"
)]
Param(
[parameter(mandatory = $true)]
[int]$id,
[parameter(mandatory = $true)]
[string]$url,
[parameter(mandatory = $true)]
[string]$apiKey
)
$Parameters = @{
Uri = "$url/api/v1/accessories/$id/checkedout"
Method = 'GET'
Token = $apiKey
}
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
{
$result = Invoke-SnipeitMethod @Parameters
}
return $result
}

View file

@ -106,7 +106,7 @@ function New-SnipeItAsset()
[string]$purchase_cost, [string]$purchase_cost,
[parameter(mandatory = $false)] [parameter(mandatory = $false)]
[string]$purchase_date, [datetime]$purchase_date,
[parameter(mandatory = $false)] [parameter(mandatory = $false)]
[int]$supplier_id, [int]$supplier_id,
@ -127,6 +127,9 @@ function New-SnipeItAsset()
$Values = . Get-ParameterValue $MyInvocation.MyCommand.Parameters $Values = . Get-ParameterValue $MyInvocation.MyCommand.Parameters
if ($values['purchase_date']) {
$values['purchase_date'] = $values['purchase_date'].ToString("yyyy-MM-dd")
}
if ($customfields) if ($customfields)
{ {

View file

@ -32,6 +32,9 @@
.PARAMETER currency .PARAMETER currency
Currency used at the location Currency used at the location
.PARAMETER city
City of the location
.PARAMETER manager_id .PARAMETER manager_id
The manager ID of the location The manager ID of the location
@ -59,12 +62,16 @@ function New-SnipeItLocation() {
[string]$address2, [string]$address2,
[string]$city,
[string]$state, [string]$state,
[string]$country, [string]$country,
[string]$zip, [string]$zip,
[string]$currency,
[int]$parent_id, [int]$parent_id,
[int]$manager_id, [int]$manager_id,

View file

@ -24,7 +24,7 @@ function Remove-SnipeItAsset ()
Param( Param(
[parameter(mandatory = $true)] [parameter(mandatory = $true)]
[int]$ID, [int]$id,
[parameter(mandatory = $true)] [parameter(mandatory = $true)]
[string]$URL, [string]$URL,
[parameter(mandatory = $true)] [parameter(mandatory = $true)]
@ -35,7 +35,7 @@ function Remove-SnipeItAsset ()
Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
$Values = @{ $Values = @{
"ID" = $Name "ID" = $id
} }
$Body = $Values | ConvertTo-Json $Body = $Values | ConvertTo-Json

View file

@ -23,7 +23,7 @@ function Remove-SnipeItAssetMaintenance {
# Asset maintenance ID # Asset maintenance ID
[Parameter(Mandatory = $true)] [Parameter(Mandatory = $true)]
[int] [int]
$ID, $id,
# SnipeIt URL # SnipeIt URL
[Parameter(Mandatory = $true)] [Parameter(Mandatory = $true)]
@ -39,7 +39,7 @@ function Remove-SnipeItAssetMaintenance {
Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
$Values = @{ $Values = @{
"ID" = $ID "ID" = $id
} }
$Body = $Values | ConvertTo-Json $Body = $Values | ConvertTo-Json

View file

@ -25,7 +25,7 @@ function Remove-SnipeItUser ()
Param( Param(
[parameter(mandatory = $true)] [parameter(mandatory = $true)]
[string]$ID, [int]$id,
[parameter(mandatory = $true)] [parameter(mandatory = $true)]
[string]$URL, [string]$URL,
[parameter(mandatory = $true)] [parameter(mandatory = $true)]
@ -36,7 +36,7 @@ function Remove-SnipeItUser ()
Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
$Values = @{ $Values = @{
"ID" = $ID "ID" = $id
} }
$Body = $Values | ConvertTo-Json $Body = $Values | ConvertTo-Json

View file

@ -0,0 +1,59 @@
<#
.SYNOPSIS
Checkin accessories
.DESCRIPTION
Checkin accessories
.PARAMETER assigned_pivot_id
This is the assigned_pivot_id of the accessory+user relationships in the accessories_users table
Use Get-SnipeItAccessoryOwner to find out nooded value
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeItInfo command
.PARAMETER apiKey
User's API Key for Snipeit, can be set using Set-SnipeItInfo command
.EXAMPLE
To get the accessories_users table for specific accessory id number
Get-SnipeItAccessoryOwner -id 1
Thenselect assigned_pivot_id for userid you like check in
Get-SnipeItAccessoryOwner -assigned_pivot_id xxx
#>
function Reset-SnipeItAccessoryOwner()
{
[CmdletBinding(
SupportsShouldProcess = $true,
ConfirmImpact = "Medium"
)]
Param(
[parameter(mandatory = $true)]
[int]$assigned_pivot_id,
[parameter(mandatory = $true)]
[string]$url,
[parameter(mandatory = $true)]
[string]$apiKey
)
$Parameters = @{
Uri = "$url/api/v1/accessories/$assigned_pivot_id/checkin"
Method = 'Post'
Body = '{}'
Token = $apiKey
}
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
{
$result = Invoke-SnipeitMethod @Parameters
}
return $result
}

View file

@ -0,0 +1,65 @@
<#
.SYNOPSIS
Checkout accessory
.DESCRIPTION
Checkout accessory to user
.PARAMETER id
Unique ID For accessory to checkout
.PARAMETER assigned_id
Id of target user
.PARAMETER note
Notes about checkout
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeItInfo command
.PARAMETER apiKey
User's API Key for Snipeit, can be set using Set-SnipeItInfo command
.EXAMPLE
Set-SnipeItAccessoryOwner -id 1 -assigned_id 1 -note "testing check out to user"
#>
function Set-SnipeItAccessoryOwner()
{
[CmdletBinding(
SupportsShouldProcess = $true,
ConfirmImpact = "Medium"
)]
Param(
[parameter(mandatory = $true)]
[int]$id,
[parameter(mandatory = $true)]
[int]$assigned_to,
[string] $note,
[parameter(mandatory = $true)]
[string]$url,
[parameter(mandatory = $true)]
[string]$apiKey
)
$Values = . Get-ParameterValue $MyInvocation.MyCommand.Parameters
$Body = $Values | ConvertTo-Json;
$Parameters = @{
Uri = "$url/api/v1/accessories/$id/checkout"
Method = 'POST'
Body = $Body
Token = $apiKey
}
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
{
$result = Invoke-SnipeitMethod @Parameters
}
return $result
}

View file

@ -50,6 +50,12 @@
.PARAMETER rtd_location_id .PARAMETER rtd_location_id
The id that corresponds to the location where the asset is usually located when not checked out The id that corresponds to the location where the asset is usually located when not checked out
.PARAMETER notes
Notes about asset
.PARAMETER RequestType
Http request type to send Snipe IT system. Defaults to Put youc use Patch if needed
.PARAMETER url .PARAMETER url
URL of Snipeit system, can be set using Set-SnipeItInfoeItInfo command URL of Snipeit system, can be set using Set-SnipeItInfoeItInfo command
@ -77,11 +83,11 @@ function Set-SnipeItAsset()
[parameter(mandatory = $true)] [parameter(mandatory = $true)]
[int]$id, [int]$id,
[string]$Name, [string]$name,
[string]$Status_id, [int]$status_id,
[string]$Model_id, [int]$model_id,
[DateTime]$last_checkout, [DateTime]$last_checkout,
@ -97,7 +103,7 @@ function Set-SnipeItAsset()
[double]$purchase_cost, [double]$purchase_cost,
[DateTime]$purchase_date, [datetime]$purchase_date,
[bool]$requestable, [bool]$requestable,
@ -105,6 +111,11 @@ function Set-SnipeItAsset()
[int]$rtd_location_id, [int]$rtd_location_id,
[string]$notes,
[ValidateSet("Put","Patch")]
[string]$RequestType = "Patch",
[parameter(mandatory = $true)] [parameter(mandatory = $true)]
[string]$url, [string]$url,
@ -118,7 +129,9 @@ function Set-SnipeItAsset()
$Values = . Get-ParameterValue $MyInvocation.MyCommand.Parameters $Values = . Get-ParameterValue $MyInvocation.MyCommand.Parameters
if ($model_id) { $Values.Add('model_id',$model_id)} if ($values['purchase_date']) {
$values['purchase_date'] = $values['purchase_date'].ToString("yyyy-MM-dd")
}
if ($customfields) if ($customfields)
{ {
@ -129,7 +142,7 @@ function Set-SnipeItAsset()
$Parameters = @{ $Parameters = @{
Uri = "$url/api/v1/hardware/$id" Uri = "$url/api/v1/hardware/$id"
Method = 'Put' Method = $RequestType
Body = $Body Body = $Body
Token = $apiKey Token = $apiKey
} }

View file

@ -47,10 +47,10 @@ function Set-SnipeItComponent()
Param( Param(
[parameter(mandatory = $true)] [parameter(mandatory = $true)]
[string]$id, [int]$id,
[parameter(mandatory = $true)] [parameter(mandatory = $true)]
[string]$qty, [int]$qty,
[string]$name, [string]$name,

View file

@ -29,6 +29,12 @@
.PARAMETER manager_id .PARAMETER manager_id
Location manager as id Location manager as id
.PARAMETER city
City of the location
.PARAMETER currency
Currency used at the location
.PARAMETER ldap_ou .PARAMETER ldap_ou
LDAP OU of Location LDAP OU of Location
@ -69,6 +75,10 @@ function Set-SnipeitLocation() {
[string]$zip, [string]$zip,
[string]$city,
[string]$currency,
[int]$manager_id, [int]$manager_id,
[string]$ldap_ou, [string]$ldap_ou,

View file

@ -12,7 +12,7 @@
RootModule = 'SnipeItPS' RootModule = 'SnipeItPS'
# Version number of this module. # Version number of this module.
ModuleVersion = '1.2' ModuleVersion = '1.3'
# Supported PSEditions # Supported PSEditions
# CompatiblePSEditions = @() # CompatiblePSEditions = @()
@ -111,7 +111,10 @@ FunctionsToExport = @(
'Get-SnipeItAccessory', 'Get-SnipeItAccessory',
'Remove-SnipeItAsset', 'Remove-SnipeItAsset',
'Remove-SnipeItUser', 'Remove-SnipeItUser',
'Update-SnipeItAlias' 'Update-SnipeItAlias',
'Set-SnipeItAccessoryOwner',
'Get-SnipeItAccessoryOwner',
'Reset-SnipeItAccessoryOwner'
) )

View file

@ -14,43 +14,5 @@ Get-ChildItem $scriptRoot *.ps1 | ForEach-Object {
Import-Module $_.FullName Import-Module $_.FullName
} }
$SnipeItAliases= @{'Get-Asset' = 'Get-SnipeItAsset';
'Get-AssetMaintenance' = 'Get-SnipeItAssetMaintenance';
'Get-Category' = 'Get-SnipeItCategory';
'Get-Company' = 'Get-SnipeItCompany';
'Get-Component' = 'Get-SnipeItCompany';
'Get-CustomField' = 'Get-SnipeItCustomField';
'Get-Department' = 'Get-SnipeItDepartment';
'Get-Fieldset' = 'Get-SnipeItFieldset';
'Get-Manufacturer' = 'Get-SnipeItManufacturer';
'Get-Model' = 'Get-SnipeItModel';
'Get-Status' = 'Get-SnipeItStatus';
'Get-Supplier' = 'Get-SnipeItSupplier';
'Get-User' = 'Get-SnipeItUser';
'New-Asset' = 'New-SnipeItAsset';
'New-AssetMaintenance' = 'New-SnipeItAssetMaintenance';
'New-Category' = 'New-SnipeItCategory';
'New-Component' = 'New-SnipeItComponent';
'New-CustomField' = 'New-SnipeItCustomField';
'New-Department' = 'New-SnipeItDepartment';
'New-License' = 'New-SnipeItLicense';
'Set-License' = 'Set-SnipeItLicense';
'New-Location' = 'New-SnipeItLocation';
'New-Manufacturer' = 'New-SnipeItManufacturer';
'New-Model' = 'New-SnipeItModel';
'New-User' = 'New-SnipeItUser';
'Set-Asset' = 'Set-SnipeItAsset';
'Set-AssetOwner' = 'Set-SnipeItAssetOwner';
'Set-Component' = 'Set-SnipeItComponent';
'Set-Model' = 'Set-SnipeItModel';
'Set-Info' = 'Set-SnipeItInfo';
'Set-User' = 'Set-SnipeItUser';
'New-Accessory' = 'New-SnipeItAccessory';
'Set-Accessory' = 'Set-SnipeItAccessory';
'Get-Accessory' = 'Get-SnipeItAccessory';
'Remove-Asset' = 'Remove-SnipeItAsset';
'Remove-User' = 'Remove-SnipeItUser';}
#Create unprefixed aliases #Create unprefixed aliases
Set-SnipeItAlias Set-SnipeItAlias

View file

@ -14,7 +14,7 @@ environment:
PSGalleryAPIKey: PSGalleryAPIKey:
secure: UdM6qhf5B0G8liHhUrwWERCZr44iSqmg4jUq0lwlTjZs4KyeoiwnBzdej0phqIAm secure: UdM6qhf5B0G8liHhUrwWERCZr44iSqmg4jUq0lwlTjZs4KyeoiwnBzdej0phqIAm
version: 1.2.{build} version: 1.3.{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

@ -0,0 +1,117 @@
---
external help file: SnipeItPS-help.xml
Module Name: SnipeitPS
online version:
schema: 2.0.0
---
# Get-SnipeItAccessoryOwner
## SYNOPSIS
Get list of checked out accessories
## SYNTAX
```
Get-SnipeItAccessoryOwner [-id] <Int32> [-url] <String> [-apiKey] <String> [-WhatIf] [-Confirm]
[<CommonParameters>]
```
## DESCRIPTION
Get list of checked out accessories
## EXAMPLES
### EXAMPLE 1
```
Get-SnipeItAccessoryOwner -id 1
```
## PARAMETERS
### -apiKey
User's API Key for Snipeit, can be set using Set-SnipeItInfo command
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -id
Unique ID For accessory to list
```yaml
Type: Int32
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False
```
### -url
URL of Snipeit system, can be set using Set-SnipeItInfo command
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -Confirm
Prompts you for confirmation before running the cmdlet.
```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -WhatIf
Shows what would happen if the cmdlet runs.
The cmdlet is not run.
```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi
Required: False
Position: Named
Default value: None
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).
## INPUTS
## OUTPUTS
## NOTES
## RELATED LINKS

View file

@ -15,9 +15,9 @@ Add a new Asset to Snipe-it asset system
``` ```
New-SnipeItAsset [-status_id] <Int32> [-model_id] <Int32> [[-name] <String>] [[-asset_tag] <String>] New-SnipeItAsset [-status_id] <Int32> [-model_id] <Int32> [[-name] <String>] [[-asset_tag] <String>]
[[-serial] <String>] [[-company_id] <Int32>] [[-order_number] <String>] [[-notes] <String>] [[-serial] <String>] [[-company_id] <Int32>] [[-order_number] <String>] [[-notes] <String>]
[[-warranty_months] <Int32>] [[-purchase_cost] <String>] [[-purchase_date] <String>] [[-supplier_id] <Int32>] [[-warranty_months] <Int32>] [[-purchase_cost] <String>] [[-purchase_date] <DateTime>]
[[-rtd_location_id] <Int32>] [-url] <String> [-apiKey] <String> [[-customfields] <Hashtable>] [-WhatIf] [[-supplier_id] <Int32>] [[-rtd_location_id] <Int32>] [-url] <String> [-apiKey] <String>
[-Confirm] [<CommonParameters>] [[-customfields] <Hashtable>] [-WhatIf] [-Confirm] [<CommonParameters>]
``` ```
## DESCRIPTION ## DESCRIPTION
@ -188,7 +188,7 @@ Accept wildcard characters: False
Optional Purchase cost of the Asset Optional Purchase cost of the Asset
```yaml ```yaml
Type: String Type: DateTime
Parameter Sets: (All) Parameter Sets: (All)
Aliases: Aliases:

View file

@ -13,9 +13,10 @@ Add a new Location to Snipe-it asset system
## SYNTAX ## SYNTAX
``` ```
New-SnipeItLocation [-name] <String> [[-address] <String>] [[-address2] <String>] [[-state] <String>] New-SnipeItLocation [-name] <String> [[-address] <String>] [[-address2] <String>] [[-city] <String>]
[[-country] <String>] [[-zip] <String>] [[-parent_id] <Int32>] [[-manager_id] <Int32>] [[-ldap_ou] <String>] [[-state] <String>] [[-country] <String>] [[-zip] <String>] [[-currency] <String>] [[-parent_id] <Int32>]
[-url] <String> [-apiKey] <String> [-WhatIf] [-Confirm] [<CommonParameters>] [[-manager_id] <Int32>] [[-ldap_ou] <String>] [-url] <String> [-apiKey] <String> [-WhatIf] [-Confirm]
[<CommonParameters>]
``` ```
## DESCRIPTION ## DESCRIPTION
@ -69,7 +70,22 @@ Parameter Sets: (All)
Aliases: Aliases:
Required: True Required: True
Position: 11 Position: 13
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -city
City of the location
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 4
Default value: None Default value: None
Accept pipeline input: False Accept pipeline input: False
Accept wildcard characters: False Accept wildcard characters: False
@ -84,7 +100,22 @@ Parameter Sets: (All)
Aliases: Aliases:
Required: False Required: False
Position: 5 Position: 6
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -currency
Currency used at the location
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 8
Default value: None Default value: None
Accept pipeline input: False Accept pipeline input: False
Accept wildcard characters: False Accept wildcard characters: False
@ -99,7 +130,7 @@ Parameter Sets: (All)
Aliases: Aliases:
Required: False Required: False
Position: 9 Position: 11
Default value: None Default value: None
Accept pipeline input: False Accept pipeline input: False
Accept wildcard characters: False Accept wildcard characters: False
@ -114,7 +145,7 @@ Parameter Sets: (All)
Aliases: Aliases:
Required: False Required: False
Position: 8 Position: 10
Default value: 0 Default value: 0
Accept pipeline input: False Accept pipeline input: False
Accept wildcard characters: False Accept wildcard characters: False
@ -144,7 +175,7 @@ Parameter Sets: (All)
Aliases: Aliases:
Required: False Required: False
Position: 7 Position: 9
Default value: 0 Default value: 0
Accept pipeline input: False Accept pipeline input: False
Accept wildcard characters: False Accept wildcard characters: False
@ -159,7 +190,7 @@ Parameter Sets: (All)
Aliases: Aliases:
Required: False Required: False
Position: 4 Position: 5
Default value: None Default value: None
Accept pipeline input: False Accept pipeline input: False
Accept wildcard characters: False Accept wildcard characters: False
@ -174,7 +205,7 @@ Parameter Sets: (All)
Aliases: Aliases:
Required: True Required: True
Position: 10 Position: 12
Default value: None Default value: None
Accept pipeline input: False Accept pipeline input: False
Accept wildcard characters: False Accept wildcard characters: False
@ -189,7 +220,7 @@ Parameter Sets: (All)
Aliases: Aliases:
Required: False Required: False
Position: 6 Position: 7
Default value: None Default value: None
Accept pipeline input: False Accept pipeline input: False
Accept wildcard characters: False Accept wildcard characters: False

View file

@ -13,7 +13,7 @@ Removes Asset from Snipe-it asset system
## SYNTAX ## SYNTAX
``` ```
Remove-SnipeItAsset [-ID] <Int32> [-URL] <String> [-APIKey] <String> [-WhatIf] [-Confirm] [<CommonParameters>] Remove-SnipeItAsset [-id] <Int32> [-URL] <String> [-APIKey] <String> [-WhatIf] [-Confirm] [<CommonParameters>]
``` ```
## DESCRIPTION ## DESCRIPTION
@ -43,7 +43,7 @@ Accept pipeline input: False
Accept wildcard characters: False Accept wildcard characters: False
``` ```
### -ID ### -id
Unique ID For Asset to be removed Unique ID For Asset to be removed
```yaml ```yaml

View file

@ -13,7 +13,7 @@ Removes User from Snipe-it asset system
## SYNTAX ## SYNTAX
``` ```
Remove-SnipeItUser [-ID] <String> [-URL] <String> [-APIKey] <String> [-WhatIf] [-Confirm] [<CommonParameters>] Remove-SnipeItUser [-id] <Int32> [-URL] <String> [-APIKey] <String> [-WhatIf] [-Confirm] [<CommonParameters>]
``` ```
## DESCRIPTION ## DESCRIPTION
@ -43,17 +43,17 @@ Accept pipeline input: False
Accept wildcard characters: False Accept wildcard characters: False
``` ```
### -ID ### -id
Unique ID For User to be removed Unique ID For User to be removed
```yaml ```yaml
Type: String Type: Int32
Parameter Sets: (All) Parameter Sets: (All)
Aliases: Aliases:
Required: True Required: True
Position: 1 Position: 1
Default value: None Default value: 0
Accept pipeline input: False Accept pipeline input: False
Accept wildcard characters: False Accept wildcard characters: False
``` ```

View file

@ -0,0 +1,124 @@
---
external help file: SnipeItPS-help.xml
Module Name: SnipeitPS
online version:
schema: 2.0.0
---
# Reset-SnipeItAccessoryOwner
## SYNOPSIS
Checkin accessories
## SYNTAX
```
Reset-SnipeItAccessoryOwner [-assigned_pivot_id] <Int32> [-url] <String> [-apiKey] <String> [-WhatIf]
[-Confirm] [<CommonParameters>]
```
## DESCRIPTION
Checkin accessories
## EXAMPLES
### EXAMPLE 1
```
To get the accessories_users table for specific accessory id number
```
Get-SnipeItAccessoryOwner -id 1
Thenselect assigned_pivot_id for userid you like check in
Get-SnipeItAccessoryOwner -assigned_pivot_id xxx
## PARAMETERS
### -apiKey
User's API Key for Snipeit, can be set using Set-SnipeItInfo command
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -assigned_pivot_id
This is the assigned_pivot_id of the accessory+user relationships in the accessories_users table
Use Get-SnipeItAccessoryOwner to find out nooded value
```yaml
Type: Int32
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False
```
### -url
URL of Snipeit system, can be set using Set-SnipeItInfo command
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -Confirm
Prompts you for confirmation before running the cmdlet.
```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -WhatIf
Shows what would happen if the cmdlet runs.
The cmdlet is not run.
```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi
Required: False
Position: Named
Default value: None
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).
## INPUTS
## OUTPUTS
## NOTES
## RELATED LINKS

View file

@ -0,0 +1,147 @@
---
external help file: SnipeItPS-help.xml
Module Name: SnipeitPS
online version:
schema: 2.0.0
---
# Set-SnipeItAccessoryOwner
## SYNOPSIS
Checkout accessory
## SYNTAX
```
Set-SnipeItAccessoryOwner [-id] <Int32> [-assigned_to] <Int32> [[-note] <String>] [-url] <String>
[-apiKey] <String> [-WhatIf] [-Confirm] [<CommonParameters>]
```
## DESCRIPTION
Checkout accessory to user
## EXAMPLES
### EXAMPLE 1
```
Set-SnipeItAccessoryOwner -id 1 -assigned_id 1 -note "testing check out to user"
```
## PARAMETERS
### -apiKey
User's API Key for Snipeit, can be set using Set-SnipeItInfo command
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 5
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -assigned_to
{{ Fill assigned_to Description }}
```yaml
Type: Int32
Parameter Sets: (All)
Aliases:
Required: True
Position: 2
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False
```
### -id
Unique ID For accessory to checkout
```yaml
Type: Int32
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False
```
### -note
Notes about checkout
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -url
URL of Snipeit system, can be set using Set-SnipeItInfo command
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 4
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -Confirm
Prompts you for confirmation before running the cmdlet.
```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -WhatIf
Shows what would happen if the cmdlet runs.
The cmdlet is not run.
```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi
Required: False
Position: Named
Default value: None
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).
## INPUTS
## OUTPUTS
## NOTES
## RELATED LINKS

View file

@ -13,11 +13,12 @@ Update a specific Asset in the Snipe-it asset system
## SYNTAX ## SYNTAX
``` ```
Set-SnipeItAsset [-id] <Int32> [[-Name] <String>] [[-Status_id] <String>] [[-Model_id] <String>] Set-SnipeItAsset [-id] <Int32> [[-name] <String>] [[-status_id] <Int32>] [[-model_id] <Int32>]
[[-last_checkout] <DateTime>] [[-assigned_to] <Int32>] [[-company_id] <Int32>] [[-serial] <String>] [[-last_checkout] <DateTime>] [[-assigned_to] <Int32>] [[-company_id] <Int32>] [[-serial] <String>]
[[-order_number] <String>] [[-warranty_months] <Int32>] [[-purchase_cost] <Double>] [[-order_number] <String>] [[-warranty_months] <Int32>] [[-purchase_cost] <Double>]
[[-purchase_date] <DateTime>] [[-requestable] <Boolean>] [[-archived] <Boolean>] [[-rtd_location_id] <Int32>] [[-purchase_date] <DateTime>] [[-requestable] <Boolean>] [[-archived] <Boolean>] [[-rtd_location_id] <Int32>]
[-url] <String> [-apiKey] <String> [[-customfields] <Hashtable>] [-WhatIf] [-Confirm] [<CommonParameters>] [[-notes] <String>] [[-RequestType] <String>] [-url] <String> [-apiKey] <String> [[-customfields] <Hashtable>]
[-WhatIf] [-Confirm] [<CommonParameters>]
``` ```
## DESCRIPTION ## DESCRIPTION
@ -46,7 +47,7 @@ Parameter Sets: (All)
Aliases: Aliases:
Required: True Required: True
Position: 17 Position: 19
Default value: None Default value: None
Accept pipeline input: False Accept pipeline input: False
Accept wildcard characters: False Accept wildcard characters: False
@ -107,7 +108,7 @@ Parameter Sets: (All)
Aliases: Aliases:
Required: False Required: False
Position: 18 Position: 20
Default value: None Default value: None
Accept pipeline input: False Accept pipeline input: False
Accept wildcard characters: False Accept wildcard characters: False
@ -143,22 +144,22 @@ Accept pipeline input: False
Accept wildcard characters: False Accept wildcard characters: False
``` ```
### -Model_id ### -model_id
Model ID of the asset, this can be got using Get-Model Model ID of the asset, this can be got using Get-Model
```yaml ```yaml
Type: String Type: Int32
Parameter Sets: (All) Parameter Sets: (All)
Aliases: Aliases:
Required: False Required: False
Position: 4 Position: 4
Default value: None Default value: 0
Accept pipeline input: False Accept pipeline input: False
Accept wildcard characters: False Accept wildcard characters: False
``` ```
### -Name ### -name
Asset name Asset name
```yaml ```yaml
@ -173,6 +174,21 @@ Accept pipeline input: False
Accept wildcard characters: False Accept wildcard characters: False
``` ```
### -notes
Notes about asset
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 16
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -order_number ### -order_number
Order number for the asset Order number for the asset
@ -233,6 +249,22 @@ Accept pipeline input: False
Accept wildcard characters: False Accept wildcard characters: False
``` ```
### -RequestType
Http request type to send Snipe IT system.
Defaults to Put youc use Patch if needed
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 17
Default value: Patch
Accept pipeline input: False
Accept wildcard characters: False
```
### -rtd_location_id ### -rtd_location_id
The id that corresponds to the location where the asset is usually located when not checked out The id that corresponds to the location where the asset is usually located when not checked out
@ -263,17 +295,17 @@ Accept pipeline input: False
Accept wildcard characters: False Accept wildcard characters: False
``` ```
### -Status_id ### -status_id
Status ID of the asset, this can be got using Get-Status Status ID of the asset, this can be got using Get-Status
```yaml ```yaml
Type: String Type: Int32
Parameter Sets: (All) Parameter Sets: (All)
Aliases: Aliases:
Required: False Required: False
Position: 3 Position: 3
Default value: None Default value: 0
Accept pipeline input: False Accept pipeline input: False
Accept wildcard characters: False Accept wildcard characters: False
``` ```
@ -287,7 +319,7 @@ Parameter Sets: (All)
Aliases: Aliases:
Required: True Required: True
Position: 16 Position: 18
Default value: None Default value: None
Accept pipeline input: False Accept pipeline input: False
Accept wildcard characters: False Accept wildcard characters: False

View file

@ -13,7 +13,7 @@ Updates component
## SYNTAX ## SYNTAX
``` ```
Set-SnipeItComponent [-id] <String> [-qty] <String> [[-name] <String>] [[-company_id] <Int32>] Set-SnipeItComponent [-id] <Int32> [-qty] <Int32> [[-name] <String>] [[-company_id] <Int32>]
[[-location_id] <Int32>] [[-purchase_date] <DateTime>] [[-purchase_cost] <Single>] [-url] <String> [[-location_id] <Int32>] [[-purchase_date] <DateTime>] [[-purchase_cost] <Single>] [-url] <String>
[-apiKey] <String> [-WhatIf] [-Confirm] [<CommonParameters>] [-apiKey] <String> [-WhatIf] [-Confirm] [<CommonParameters>]
``` ```
@ -64,13 +64,13 @@ Accept wildcard characters: False
ID number of name ID number of name
```yaml ```yaml
Type: String Type: Int32
Parameter Sets: (All) Parameter Sets: (All)
Aliases: Aliases:
Required: True Required: True
Position: 1 Position: 1
Default value: None Default value: 0
Accept pipeline input: False Accept pipeline input: False
Accept wildcard characters: False Accept wildcard characters: False
``` ```
@ -139,13 +139,13 @@ Accept wildcard characters: False
Quantity of the components you have Quantity of the components you have
```yaml ```yaml
Type: String Type: Int32
Parameter Sets: (All) Parameter Sets: (All)
Aliases: Aliases:
Required: True Required: True
Position: 2 Position: 2
Default value: None Default value: 0
Accept pipeline input: False Accept pipeline input: False
Accept wildcard characters: False Accept wildcard characters: False
``` ```

View file

@ -14,8 +14,9 @@ Updates Location in Snipe-it asset system
``` ```
Set-SnipeitLocation [-id] <Int32> [[-name] <String>] [[-address] <String>] [[-address2] <String>] Set-SnipeitLocation [-id] <Int32> [[-name] <String>] [[-address] <String>] [[-address2] <String>]
[[-state] <String>] [[-country] <String>] [[-zip] <String>] [[-manager_id] <Int32>] [[-ldap_ou] <String>] [[-state] <String>] [[-country] <String>] [[-zip] <String>] [[-city] <String>] [[-currency] <String>]
[[-parent_id] <Int32>] [-url] <String> [-apiKey] <String> [-WhatIf] [-Confirm] [<CommonParameters>] [[-manager_id] <Int32>] [[-ldap_ou] <String>] [[-parent_id] <Int32>] [-url] <String> [-apiKey] <String>
[-WhatIf] [-Confirm] [<CommonParameters>]
``` ```
## DESCRIPTION ## DESCRIPTION
@ -69,7 +70,22 @@ Parameter Sets: (All)
Aliases: Aliases:
Required: True Required: True
Position: 12 Position: 14
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -city
City of the location
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 8
Default value: None Default value: None
Accept pipeline input: False Accept pipeline input: False
Accept wildcard characters: False Accept wildcard characters: False
@ -90,6 +106,21 @@ Accept pipeline input: False
Accept wildcard characters: False Accept wildcard characters: False
``` ```
### -currency
Currency used at the location
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 9
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -id ### -id
{{ Fill id Description }} {{ Fill id Description }}
@ -114,7 +145,7 @@ Parameter Sets: (All)
Aliases: Aliases:
Required: False Required: False
Position: 9 Position: 11
Default value: None Default value: None
Accept pipeline input: False Accept pipeline input: False
Accept wildcard characters: False Accept wildcard characters: False
@ -129,7 +160,7 @@ Parameter Sets: (All)
Aliases: Aliases:
Required: False Required: False
Position: 8 Position: 10
Default value: 0 Default value: 0
Accept pipeline input: False Accept pipeline input: False
Accept wildcard characters: False Accept wildcard characters: False
@ -159,7 +190,7 @@ Parameter Sets: (All)
Aliases: Aliases:
Required: False Required: False
Position: 10 Position: 12
Default value: 0 Default value: 0
Accept pipeline input: False Accept pipeline input: False
Accept wildcard characters: False Accept wildcard characters: False
@ -189,7 +220,7 @@ Parameter Sets: (All)
Aliases: Aliases:
Required: True Required: True
Position: 11 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,6 +14,9 @@ Locale: en-US
### [Get-SnipeItAccessory](Get-SnipeItAccessory.md) ### [Get-SnipeItAccessory](Get-SnipeItAccessory.md)
Gets a list of Snipe-it Accessories Gets a list of Snipe-it Accessories
### [Get-SnipeItAccessoryOwner](Get-SnipeItAccessoryOwner.md)
Get list of checked out accessories
### [Get-SnipeItAsset](Get-SnipeItAsset.md) ### [Get-SnipeItAsset](Get-SnipeItAsset.md)
Gets a list of Snipe-it Assets or specific asset Gets a list of Snipe-it Assets or specific asset
@ -92,9 +95,15 @@ Removes Asset from Snipe-it asset system
### [Remove-SnipeItUser](Remove-SnipeItUser.md) ### [Remove-SnipeItUser](Remove-SnipeItUser.md)
Removes User from Snipe-it asset system Removes User from Snipe-it asset system
### [Reset-SnipeItAccessoryOwner](Reset-SnipeItAccessoryOwner.md)
Checkin accessories
### [Set-SnipeItAccessory](Set-SnipeItAccessory.md) ### [Set-SnipeItAccessory](Set-SnipeItAccessory.md)
Updates accessory on Snipe-It system Updates accessory on Snipe-It system
### [Set-SnipeItAccessoryOwner](Set-SnipeItAccessoryOwner.md)
Checkout accessory
### [Set-SnipeItAsset](Set-SnipeItAsset.md) ### [Set-SnipeItAsset](Set-SnipeItAsset.md)
Update a specific Asset in the Snipe-it asset system Update a specific Asset in the Snipe-it asset system