mirror of
https://github.com/snazy2000/SnipeitPS.git
synced 2025-12-14 02:12:29 +00:00
Merge pull request #98 from snazy2000/develop
Develop to master , first 1.1.x version
This commit is contained in:
commit
75fb4caad9
38 changed files with 1190 additions and 167 deletions
|
|
@ -21,23 +21,21 @@ function Get-ParameterValue {
|
||||||
# }
|
# }
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
param(
|
param(
|
||||||
# The $MyInvocation for the caller -- DO NOT pass this (dot-source Get-ParameterValues instead)
|
# Pass $MyInvocation.MyCommand.Parameters to function, powershell 7 seems to only populate variables with dot sourcing
|
||||||
$Invocation = $MyInvocation,
|
[parameter(mandatory = $true)]
|
||||||
# The $PSBoundParameters for the caller -- DO NOT pass this (dot-source Get-ParameterValues instead)
|
$Parameters
|
||||||
$BoundParameters = $PSBoundParameters,
|
,
|
||||||
|
|
||||||
[string[]]$DefaultExcludeParameter = @("id", "url", "apiKey", 'Debug', 'Verbose')
|
[string[]]$DefaultExcludeParameter = @("id", "url", "apiKey", 'Debug', 'Verbose','RequestType','customfields')
|
||||||
)
|
)
|
||||||
|
|
||||||
if ($MyInvocation.Line[($MyInvocation.OffsetInLine - 1)] -ne '.') {
|
if ($MyInvocation.Line[($MyInvocation.OffsetInLine - 1)] -ne '.') {
|
||||||
throw "Get-ParameterValues must be dot-sourced, like this: . Get-ParameterValues"
|
throw "Get-ParameterValue must be dot-sourced, like this: . Get-ParameterValues"
|
||||||
}
|
|
||||||
if ($PSBoundParameters.Count -gt 0) {
|
|
||||||
throw "You should not pass parameters to Get-ParameterValues, just dot-source it like this: . Get-ParameterValues"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$ParameterValues = @{}
|
$ParameterValues = @{}
|
||||||
foreach ($parameter in $Invocation.MyCommand.Parameters.GetEnumerator()) {
|
foreach ($parameter in $Parameters.GetEnumerator()) {
|
||||||
# gm -in $parameter.Value | Out-Default
|
# gm -in $parameter.Value | Out-Default
|
||||||
try {
|
try {
|
||||||
$key = $parameter.Key
|
$key = $parameter.Key
|
||||||
|
|
@ -48,9 +46,6 @@ function Get-ParameterValue {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($BoundParameters.ContainsKey($key)) {
|
|
||||||
$ParameterValues[$key] = $BoundParameters[$key]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally {}
|
finally {}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,35 @@
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
# Gets a list of Snipe-it Accessories
|
||||||
|
|
||||||
|
.PARAMETER search
|
||||||
|
A text string to search the Accessory data
|
||||||
|
|
||||||
|
.PARAMETER id
|
||||||
|
A id of specific Accessory
|
||||||
|
|
||||||
|
.PARAMETER limit
|
||||||
|
Specify the number of results you wish to return. Defaults to 50. Defines batch size for -all
|
||||||
|
|
||||||
|
.PARAMETER offset
|
||||||
|
Offset to use
|
||||||
|
|
||||||
|
.PARAMETER all
|
||||||
|
A return all results, works with -offset and other parameters
|
||||||
|
|
||||||
|
.PARAMETER url
|
||||||
|
URL of Snipeit system, can be set using Set-Info command
|
||||||
|
|
||||||
|
.PARAMETER apiKey
|
||||||
|
Users API Key for Snipeit, can be set using Set-Info command
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
Get-Accessory -url "https://assets.example.com" -token "token..."
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
Get-Accessory -url "https://assets.example.com" -token "token..." | Where-Object {$_.name -eq "HP" }
|
||||||
|
|
||||||
|
#>
|
||||||
function Get-Accessory() {
|
function Get-Accessory() {
|
||||||
Param(
|
Param(
|
||||||
[string]$search,
|
[string]$search,
|
||||||
|
|
@ -19,6 +51,8 @@ function Get-Accessory() {
|
||||||
|
|
||||||
[int]$offset,
|
[int]$offset,
|
||||||
|
|
||||||
|
[switch]$all = $false,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $true)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
|
|
@ -26,7 +60,7 @@ function Get-Accessory() {
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
|
||||||
$SearchParameter = . Get-ParameterValue
|
$SearchParameter = . Get-ParameterValue $MyInvocation.MyCommand.Parameters
|
||||||
|
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/accessories"
|
Uri = "$url/api/v1/accessories"
|
||||||
|
|
@ -35,9 +69,25 @@ function Get-Accessory() {
|
||||||
Token = $apiKey
|
Token = $apiKey
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
if ($all) {
|
||||||
|
$offstart = $(if($offset){$offset} Else {0})
|
||||||
|
$callargs = $SearchParameter
|
||||||
|
$callargs.Remove('all')
|
||||||
|
|
||||||
$result
|
while ($true) {
|
||||||
|
$callargs['offset'] = $offstart
|
||||||
|
$callargs['limit'] = $limit
|
||||||
|
$res=Get-Accessory @callargs
|
||||||
|
$res
|
||||||
|
if ($res.count -lt $limit) {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
$offstart = $offstart + $limit
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
|
$result
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,15 @@
|
||||||
.PARAMETER search
|
.PARAMETER search
|
||||||
A text string to search the assets data
|
A text string to search the assets data
|
||||||
|
|
||||||
|
.PARAMETER id
|
||||||
|
A text string to search the assets data
|
||||||
|
|
||||||
|
.PARAMETER asset_tag
|
||||||
|
Specify exact asset tag to query
|
||||||
|
|
||||||
|
.PARAMETER asset_serial
|
||||||
|
Specify exact asset serial to query
|
||||||
|
|
||||||
.PARAMETER order_number
|
.PARAMETER order_number
|
||||||
Optionally restrict asset results to this order number
|
Optionally restrict asset results to this order number
|
||||||
|
|
||||||
|
|
@ -36,11 +45,14 @@ Specify the column name you wish to sort by
|
||||||
Specify the order (asc or desc) you wish to order by on your sort column
|
Specify the order (asc or desc) you wish to order by on your sort column
|
||||||
|
|
||||||
.PARAMETER limit
|
.PARAMETER limit
|
||||||
Specify the number of results you wish to return. Defaults to 50.
|
Specify the number of results you wish to return. Defaults to 50. Defines batch size for -all
|
||||||
|
|
||||||
.PARAMETER offset
|
.PARAMETER offset
|
||||||
Offset to use
|
Offset to use
|
||||||
|
|
||||||
|
.PARAMETER all
|
||||||
|
A return all results, works with -offset and other parameters
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-Info command
|
URL of Snipeit system, can be set using Set-Info command
|
||||||
|
|
||||||
|
|
@ -48,18 +60,27 @@ URL of Snipeit system, can be set using Set-Info command
|
||||||
Users API Key for Snipeit, can be set using Set-Info command
|
Users API Key for Snipeit, can be set using Set-Info command
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Get-Asset -url "https://assets.example.com" -token "token..."
|
Get-Asset -url "https://assets.example.com"-token "token..."
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Get-Asset -search "myMachine" -url "https://assets.example.com" -token "token..."
|
Get-Asset -search "myMachine"-url "https://assets.example.com"-token "token..."
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Get-Asset -search "myMachine" -url "https://assets.example.com" -token "token..."
|
Get-Asset -search "myMachine"-url "https://assets.example.com"-token "token..."
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
Get-Asset -asset_tag "myAssetTag"-url "https://assets.example.com"-token "token..."
|
||||||
#>
|
#>
|
||||||
function Get-Asset() {
|
function Get-Asset() {
|
||||||
Param(
|
Param(
|
||||||
[string]$search,
|
[string]$search,
|
||||||
|
|
||||||
|
[string]$id,
|
||||||
|
|
||||||
|
[string]$asset_tag,
|
||||||
|
|
||||||
|
[string]$asset_serial,
|
||||||
|
|
||||||
[int]$order_number,
|
[int]$order_number,
|
||||||
|
|
||||||
[int]$model_id,
|
[int]$model_id,
|
||||||
|
|
@ -89,6 +110,7 @@ function Get-Asset() {
|
||||||
|
|
||||||
[int]$offset,
|
[int]$offset,
|
||||||
|
|
||||||
|
[switch]$all = $false,
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $true)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
|
|
@ -96,18 +118,64 @@ function Get-Asset() {
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
|
||||||
$SearchParameter = . Get-ParameterValue
|
$SearchParameter = . Get-ParameterValue $MyInvocation.MyCommand.Parameters
|
||||||
|
|
||||||
|
|
||||||
|
$apiurl = "$url/api/v1/hardware"
|
||||||
|
|
||||||
|
if ($search -and ($asset_tag -or $asset_serial -or $id)) {
|
||||||
|
Throw "[$($MyInvocation.MyCommand.Name)] Please specify only one of -search , -asset_tag or -asset_serial parameter"
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($id) {
|
||||||
|
if ( $search -or $asset_serial -or $asset_tag) {
|
||||||
|
Throw "[$($MyInvocation.MyCommand.Name)] Please specify only one of -search , -asset_tag or -asset_serial parameter"
|
||||||
|
}
|
||||||
|
$apiurl= "$url/api/v1/hardware/$id"
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($asset_tag) {
|
||||||
|
if ( $search -or $asset_serial -or $id) {
|
||||||
|
Throw "[$($MyInvocation.MyCommand.Name)] Please specify only one of -search , -asset_tag or -asset_serial parameter"
|
||||||
|
}
|
||||||
|
$apiurl= "$url/api/v1/hardware/bytag/$asset_tag"
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($asset_serial) {
|
||||||
|
if ( $search -or $asset_tag) {
|
||||||
|
Throw "[$($MyInvocation.MyCommand.Name)] Please specify only one of-search , -asset_tag or -asset_serial parameter"
|
||||||
|
}
|
||||||
|
$apiurl= "$url/api/v1/hardware/byserial/$asset_serial"
|
||||||
|
}
|
||||||
|
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/hardware"
|
Uri = $apiurl
|
||||||
Method = 'Get'
|
Method = 'Get'
|
||||||
GetParameters = $SearchParameter
|
GetParameters = $SearchParameter
|
||||||
Token = $apiKey
|
Token = $apiKey
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
if ($all) {
|
||||||
|
$offstart = $(if ($offset){$offset} Else {0})
|
||||||
|
$callargs = $SearchParameter
|
||||||
|
$callargs.Remove('all')
|
||||||
|
|
||||||
|
while ($true) {
|
||||||
|
$callargs['offset'] = $offstart
|
||||||
|
$callargs['limit'] = $limit
|
||||||
|
$res=Get-Asset @callargs
|
||||||
|
$res
|
||||||
|
if ( $res.count -lt $limit) {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
$offstart = $offstart + $limit
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
|
$result
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$result
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,14 @@ Specify the column name you wish to sort by
|
||||||
Specify the order (asc or desc) you wish to order by on your sort column
|
Specify the order (asc or desc) you wish to order by on your sort column
|
||||||
|
|
||||||
.PARAMETER limit
|
.PARAMETER limit
|
||||||
Specify the number of results you wish to return. Defaults to 50.
|
Specify the number of results you wish to return. Defaults to 50. Defines batch size for -all
|
||||||
|
|
||||||
.PARAMETER offset
|
.PARAMETER offset
|
||||||
Offset to use
|
Offset to use
|
||||||
|
|
||||||
|
.PARAMETER all
|
||||||
|
A return all results, works with -offset and other parameters
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-Info command
|
URL of Snipeit system, can be set using Set-Info command
|
||||||
|
|
||||||
|
|
@ -48,6 +51,8 @@ function Get-AssetMaintenance() {
|
||||||
|
|
||||||
[int]$limit = 50,
|
[int]$limit = 50,
|
||||||
|
|
||||||
|
[switch]$all = $false,
|
||||||
|
|
||||||
[int]$offset,
|
[int]$offset,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $true)]
|
||||||
|
|
@ -57,7 +62,7 @@ function Get-AssetMaintenance() {
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
|
||||||
$SearchParameter = . Get-ParameterValue
|
$SearchParameter = . Get-ParameterValue $MyInvocation.MyCommand.Parameters
|
||||||
|
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/maintenances"
|
Uri = "$url/api/v1/maintenances"
|
||||||
|
|
@ -66,9 +71,25 @@ function Get-AssetMaintenance() {
|
||||||
Token = $apiKey
|
Token = $apiKey
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
if ($all) {
|
||||||
|
$offstart = $(if($offset){$offset} Else {0})
|
||||||
|
$callargs = $SearchParameter
|
||||||
|
$callargs.Remove('all')
|
||||||
|
|
||||||
$result
|
while ($true) {
|
||||||
|
$callargs['offset'] = $offstart
|
||||||
|
$callargs['limit'] = $limit
|
||||||
|
$res=Get-AssetMaintenance @callargs
|
||||||
|
$res
|
||||||
|
if ($res.count -lt $limit) {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
$offstart = $offstart + $limit
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
|
$result
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,21 @@
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
# Gets a list of Snipe-it Categories
|
# Gets a list of Snipe-it Categories
|
||||||
|
|
||||||
|
.PARAMETER search
|
||||||
|
A text string to search the Categories data
|
||||||
|
|
||||||
|
.PARAMETER id
|
||||||
|
A id of specific Category
|
||||||
|
|
||||||
|
.PARAMETER limit
|
||||||
|
Specify the number of results you wish to return. Defaults to 50. Defines batch size for -all
|
||||||
|
|
||||||
|
.PARAMETER offset
|
||||||
|
Offset to use
|
||||||
|
|
||||||
|
.PARAMETER all
|
||||||
|
A return all results, works with -offset and other parameters
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-Info command
|
URL of Snipeit system, can be set using Set-Info command
|
||||||
|
|
||||||
|
|
@ -21,6 +36,8 @@ function Get-Category()
|
||||||
Param(
|
Param(
|
||||||
[string]$search,
|
[string]$search,
|
||||||
|
|
||||||
|
[string]$id,
|
||||||
|
|
||||||
[ValidateSet("asc", "desc")]
|
[ValidateSet("asc", "desc")]
|
||||||
[string]$order = "desc",
|
[string]$order = "desc",
|
||||||
|
|
||||||
|
|
@ -28,6 +45,8 @@ function Get-Category()
|
||||||
|
|
||||||
[int]$offset,
|
[int]$offset,
|
||||||
|
|
||||||
|
[switch]$all = $false,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $true)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
|
|
@ -35,16 +54,42 @@ function Get-Category()
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
|
||||||
$SearchParameter = . Get-ParameterValue
|
$SearchParameter = . Get-ParameterValue $MyInvocation.MyCommand.Parameters
|
||||||
|
|
||||||
|
$apiurl = "$url/api/v1/categories"
|
||||||
|
|
||||||
|
if ($search -and $id ) {
|
||||||
|
Throw "[$($MyInvocation.MyCommand.Name)] Please specify only -search or -id parameter , not both "
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($id) {
|
||||||
|
$apiurl= "$url/api/v1/categories/$id"
|
||||||
|
}
|
||||||
|
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/categories"
|
Uri = $apiurl
|
||||||
Method = 'Get'
|
Method = 'Get'
|
||||||
Token = $apiKey
|
Token = $apiKey
|
||||||
GetParameters = $SearchParameter
|
GetParameters = $SearchParameter
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
if ($all) {
|
||||||
|
$offstart = $(if($offset){$offset} Else {0})
|
||||||
|
$callargs = $SearchParameter
|
||||||
|
$callargs.Remove('all')
|
||||||
|
|
||||||
$result
|
while ($true) {
|
||||||
|
$callargs['offset'] = $offstart
|
||||||
|
$callargs['limit'] = $limit
|
||||||
|
$res=Get-Category @callargs
|
||||||
|
$res
|
||||||
|
if ($res.count -lt $limit) {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
$offstart = $offstart + $limit
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
|
$result
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,21 @@
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
# Gets a list of Snipe-it Companies
|
# Gets a list of Snipe-it Companies
|
||||||
|
|
||||||
|
.PARAMETER search
|
||||||
|
A text string to search the Companies data
|
||||||
|
|
||||||
|
.PARAMETER id
|
||||||
|
A id of specific Company
|
||||||
|
|
||||||
|
.PARAMETER limit
|
||||||
|
Specify the number of results you wish to return. Defaults to 50. Defines batch size for -all
|
||||||
|
|
||||||
|
.PARAMETER offset
|
||||||
|
Offset to use
|
||||||
|
|
||||||
|
.PARAMETER all
|
||||||
|
A return all results, works with -offset and other parameters
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-Info command
|
URL of Snipeit system, can be set using Set-Info command
|
||||||
|
|
||||||
|
|
@ -21,6 +36,8 @@ function Get-Company()
|
||||||
Param(
|
Param(
|
||||||
[string]$search,
|
[string]$search,
|
||||||
|
|
||||||
|
[string]$id,
|
||||||
|
|
||||||
[ValidateSet("asc", "desc")]
|
[ValidateSet("asc", "desc")]
|
||||||
[string]$order = "desc",
|
[string]$order = "desc",
|
||||||
|
|
||||||
|
|
@ -28,6 +45,8 @@ function Get-Company()
|
||||||
|
|
||||||
[int]$offset,
|
[int]$offset,
|
||||||
|
|
||||||
|
[switch]$all = $false,
|
||||||
|
|
||||||
[parameter(mandatory=$true)]
|
[parameter(mandatory=$true)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
|
|
@ -35,16 +54,42 @@ function Get-Company()
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
|
||||||
$SearchParameter = . Get-ParameterValue
|
$SearchParameter = . Get-ParameterValue $MyInvocation.MyCommand.Parameters
|
||||||
|
|
||||||
|
$apiurl = "$url/api/v1/companies"
|
||||||
|
|
||||||
|
if ($search -and $id ) {
|
||||||
|
Throw "[$($MyInvocation.MyCommand.Name)] Please specify only -search or -id parameter , not both "
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($id) {
|
||||||
|
$apiurl= "$url/api/v1/companies/$id"
|
||||||
|
}
|
||||||
|
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/companies"
|
Uri = $apiurl
|
||||||
Method = 'Get'
|
Method = 'Get'
|
||||||
Token = $apiKey
|
Token = $apiKey
|
||||||
GetParameters = $SearchParameter
|
GetParameters = $SearchParameter
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
if ($all) {
|
||||||
|
$offstart = $(if($offset){$offset} Else {0})
|
||||||
|
$callargs = $SearchParameter
|
||||||
|
$callargs.Remove('all')
|
||||||
|
|
||||||
$result
|
while ($true) {
|
||||||
|
$callargs['offset'] = $offstart
|
||||||
|
$callargs['limit'] = $limit
|
||||||
|
$res=Get-Company @callargs
|
||||||
|
$res
|
||||||
|
if ($res.count -lt $limit) {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
$offstart = $offstart + $limit
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
|
$result
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,21 @@
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
# Gets a list of Snipe-it Components
|
# Gets a list of Snipe-it Components
|
||||||
|
|
||||||
|
.PARAMETER search
|
||||||
|
A text string to search the Components data
|
||||||
|
|
||||||
|
.PARAMETER id
|
||||||
|
A id of specific Component
|
||||||
|
|
||||||
|
.PARAMETER limit
|
||||||
|
Specify the number of results you wish to return. Defaults to 50. Defines batch size for -all
|
||||||
|
|
||||||
|
.PARAMETER offset
|
||||||
|
Offset to use
|
||||||
|
|
||||||
|
.PARAMETER all
|
||||||
|
A return all results, works with -offset and other parameters
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-Info command
|
URL of Snipeit system, can be set using Set-Info command
|
||||||
|
|
||||||
|
|
@ -20,6 +35,8 @@ function Get-Component() {
|
||||||
Param(
|
Param(
|
||||||
[string]$search,
|
[string]$search,
|
||||||
|
|
||||||
|
[string]$id,
|
||||||
|
|
||||||
[int]$category_id,
|
[int]$category_id,
|
||||||
|
|
||||||
[int]$company_id,
|
[int]$company_id,
|
||||||
|
|
@ -36,6 +53,8 @@ function Get-Component() {
|
||||||
|
|
||||||
[int]$offset,
|
[int]$offset,
|
||||||
|
|
||||||
|
[switch]$all = $false,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $true)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
|
|
@ -43,16 +62,42 @@ function Get-Component() {
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
|
||||||
$SearchParameter = . Get-ParameterValue
|
$SearchParameter = . Get-ParameterValue $MyInvocation.MyCommand.Parameters
|
||||||
|
|
||||||
|
$apiurl = "$url/api/v1/components"
|
||||||
|
|
||||||
|
if ($search -and $id ) {
|
||||||
|
Throw "[$($MyInvocation.MyCommand.Name)] Please specify only -search or -id parameter , not both "
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($id) {
|
||||||
|
$apiurl= "$url/api/v1/components/$id"
|
||||||
|
}
|
||||||
|
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/components"
|
Uri = $apiurl
|
||||||
Method = 'Get'
|
Method = 'Get'
|
||||||
Token = $apiKey
|
Token = $apiKey
|
||||||
GetParameters = $SearchParameter
|
GetParameters = $SearchParameter
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
if ($all) {
|
||||||
|
$offstart = $(if($offset){$offset} Else {0})
|
||||||
|
$callargs = $SearchParameter
|
||||||
|
$callargs.Remove('all')
|
||||||
|
|
||||||
$result
|
while ($true) {
|
||||||
|
$callargs['offset'] = $offstart
|
||||||
|
$callargs['limit'] = $limit
|
||||||
|
$res=Get-Component @callargs
|
||||||
|
$res
|
||||||
|
if ($res.count -lt $limit) {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
$offstart = $offstart + $limit
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
|
$result
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ function Get-CustomField()
|
||||||
Token = $apiKey
|
Token = $apiKey
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
|
|
||||||
$result
|
$result
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,21 @@
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
# Gets a list of Snipe-it Departments
|
# Gets a list of Snipe-it Departments
|
||||||
|
|
||||||
|
.PARAMETER search
|
||||||
|
A text string to search the Departments data
|
||||||
|
|
||||||
|
.PARAMETER id
|
||||||
|
A id of specific Department
|
||||||
|
|
||||||
|
.PARAMETER limit
|
||||||
|
Specify the number of results you wish to return. Defaults to 50. Defines batch size for -all
|
||||||
|
|
||||||
|
.PARAMETER offset
|
||||||
|
Offset to use
|
||||||
|
|
||||||
|
.PARAMETER all
|
||||||
|
A return all results, works with -offset and other parameters
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-Info command
|
URL of Snipeit system, can be set using Set-Info command
|
||||||
|
|
||||||
|
|
@ -21,6 +36,8 @@ function Get-Department()
|
||||||
Param(
|
Param(
|
||||||
[string]$search,
|
[string]$search,
|
||||||
|
|
||||||
|
[string]$id,
|
||||||
|
|
||||||
[ValidateSet("asc", "desc")]
|
[ValidateSet("asc", "desc")]
|
||||||
[string]$order = "desc",
|
[string]$order = "desc",
|
||||||
|
|
||||||
|
|
@ -28,6 +45,8 @@ function Get-Department()
|
||||||
|
|
||||||
[int]$offset,
|
[int]$offset,
|
||||||
|
|
||||||
|
[switch]$all = $false,
|
||||||
|
|
||||||
[ValidateSet('id', 'name', 'image', 'users_count', 'created_at')]
|
[ValidateSet('id', 'name', 'image', 'users_count', 'created_at')]
|
||||||
[string]$sort = "created_at",
|
[string]$sort = "created_at",
|
||||||
|
|
||||||
|
|
@ -38,17 +57,43 @@ function Get-Department()
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
|
||||||
$SearchParameter = . Get-ParameterValue
|
$SearchParameter = . Get-ParameterValue $MyInvocation.MyCommand.Parameters
|
||||||
|
|
||||||
|
$apiurl = "$url/api/v1/departments"
|
||||||
|
|
||||||
|
if ($search -and $id ) {
|
||||||
|
Throw "[$($MyInvocation.MyCommand.Name)] Please specify only -search or -id parameter , not both "
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($id) {
|
||||||
|
$apiurl= "$url/api/v1/departments/$id"
|
||||||
|
}
|
||||||
|
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/departments"
|
Uri = $apiurl
|
||||||
Method = 'Get'
|
Method = 'Get'
|
||||||
Token = $apiKey
|
Token = $apiKey
|
||||||
GetParameters = $SearchParameter
|
GetParameters = $SearchParameter
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
if ($all) {
|
||||||
|
$offstart = $(if($offset){$offset} Else {0})
|
||||||
|
$callargs = $SearchParameter
|
||||||
|
$callargs.Remove('all')
|
||||||
|
|
||||||
$result
|
while ($true) {
|
||||||
|
$callargs['offset'] = $offstart
|
||||||
|
$callargs['limit'] = $limit
|
||||||
|
$res=Get-Department @callargs
|
||||||
|
$res
|
||||||
|
if ($res.count -lt $limit) {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
$offstart = $offstart + $limit
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
|
$result
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,22 @@
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
# Gets a list of Snipe-it Licenses
|
# Gets a list of Snipe-it Licenses
|
||||||
|
|
||||||
|
.PARAMETER search
|
||||||
|
A text string to search the Licenses data
|
||||||
|
|
||||||
|
.PARAMETER id
|
||||||
|
A id of specific License
|
||||||
|
|
||||||
|
.PARAMETER limit
|
||||||
|
Specify the number of results you wish to return. Defaults to 50. Defines batch size for -all
|
||||||
|
|
||||||
|
.PARAMETER offset
|
||||||
|
Offset to use
|
||||||
|
|
||||||
|
.PARAMETER all
|
||||||
|
A return all results, works with -offset and other parameters
|
||||||
|
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-Info command
|
URL of Snipeit system, can be set using Set-Info command
|
||||||
|
|
||||||
|
|
@ -20,6 +36,8 @@ function Get-License() {
|
||||||
Param(
|
Param(
|
||||||
[string]$search,
|
[string]$search,
|
||||||
|
|
||||||
|
[string]$id,
|
||||||
|
|
||||||
[string]$name,
|
[string]$name,
|
||||||
|
|
||||||
[int] $company_id,
|
[int] $company_id,
|
||||||
|
|
@ -52,6 +70,8 @@ function Get-License() {
|
||||||
|
|
||||||
[int]$offset,
|
[int]$offset,
|
||||||
|
|
||||||
|
[switch]$all = $false,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $true)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
|
|
@ -59,17 +79,43 @@ function Get-License() {
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
|
||||||
$SearchParameter = . Get-ParameterValue
|
$SearchParameter = . Get-ParameterValue $MyInvocation.MyCommand.Parameters
|
||||||
|
|
||||||
|
$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"
|
||||||
|
}
|
||||||
|
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/licenses"
|
Uri = $apiurl
|
||||||
Method = 'Get'
|
Method = 'Get'
|
||||||
Token = $apiKey
|
Token = $apiKey
|
||||||
GetParameters = $SearchParameter
|
GetParameters = $SearchParameter
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
if ($all) {
|
||||||
|
$offstart = $(if($offset){$offset} Else {0})
|
||||||
|
$callargs = $SearchParameter
|
||||||
|
$callargs.Remove('all')
|
||||||
|
|
||||||
$result
|
while ($true) {
|
||||||
|
$callargs['offset'] = $offstart
|
||||||
|
$callargs['limit'] = $limit
|
||||||
|
$res=Get-License @callargs
|
||||||
|
$res
|
||||||
|
if ($res.count -lt $limit) {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
$offstart = $offstart + $limit
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
|
$result
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,21 @@
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
# Gets a list of Snipe-it Manufacturers
|
# Gets a list of Snipe-it Manufacturers
|
||||||
|
|
||||||
|
.PARAMETER search
|
||||||
|
A text string to search the Manufactures data
|
||||||
|
|
||||||
|
.PARAMETER id
|
||||||
|
A id of specific Manufactuter
|
||||||
|
|
||||||
|
.PARAMETER limit
|
||||||
|
Specify the number of results you wish to return. Defaults to 50. Defines batch size for -all
|
||||||
|
|
||||||
|
.PARAMETER offset
|
||||||
|
Offset to use
|
||||||
|
|
||||||
|
.PARAMETER all
|
||||||
|
A return all results, works with -offset and other parameters
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-Info command
|
URL of Snipeit system, can be set using Set-Info command
|
||||||
|
|
||||||
|
|
@ -21,6 +36,8 @@ function Get-Manufacturer()
|
||||||
Param(
|
Param(
|
||||||
[string]$search,
|
[string]$search,
|
||||||
|
|
||||||
|
[string]$id,
|
||||||
|
|
||||||
[ValidateSet("asc", "desc")]
|
[ValidateSet("asc", "desc")]
|
||||||
[string]$order = "desc",
|
[string]$order = "desc",
|
||||||
|
|
||||||
|
|
@ -28,6 +45,8 @@ function Get-Manufacturer()
|
||||||
|
|
||||||
[int]$offset,
|
[int]$offset,
|
||||||
|
|
||||||
|
[switch]$all = $false,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $true)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
|
|
@ -35,16 +54,42 @@ function Get-Manufacturer()
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
|
||||||
$SearchParameter = . Get-ParameterValue
|
$SearchParameter = . Get-ParameterValue $MyInvocation.MyCommand.Parameters
|
||||||
|
|
||||||
|
$apiurl = "$url/api/v1/manufacturers"
|
||||||
|
|
||||||
|
if ($search -and $id ) {
|
||||||
|
Throw "[$($MyInvocation.MyCommand.Name)] Please specify only -search or -id parameter , not both "
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($id) {
|
||||||
|
$apiurl= "$url/api/v1/manufacturers/$id"
|
||||||
|
}
|
||||||
|
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/manufacturers"
|
Uri = $apiurl
|
||||||
Method = 'Get'
|
Method = 'Get'
|
||||||
Token = $apiKey
|
Token = $apiKey
|
||||||
GetParameters = $SearchParameter
|
GetParameters = $SearchParameter
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
if ($all) {
|
||||||
|
$offstart = $(if($offset){$offset} Else {0})
|
||||||
|
$callargs = $SearchParameter
|
||||||
|
$callargs.Remove('all')
|
||||||
|
|
||||||
$result
|
while ($true) {
|
||||||
|
$callargs['offset'] = $offstart
|
||||||
|
$callargs['limit'] = $limit
|
||||||
|
$res=Get-Manufacturer @callargs
|
||||||
|
$res
|
||||||
|
if ($res.count -lt $limit) {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
$offstart = $offstart + $limit
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
|
$result
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,21 @@
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
# Gets a list of Snipe-it Models
|
# Gets a list of Snipe-it Models
|
||||||
|
|
||||||
|
.PARAMETER search
|
||||||
|
A text string to search the Models data
|
||||||
|
|
||||||
|
.PARAMETER id
|
||||||
|
A id of specific model
|
||||||
|
|
||||||
|
.PARAMETER limit
|
||||||
|
Specify the number of results you wish to return. Defaults to 50. Defines batch size for -all
|
||||||
|
|
||||||
|
.PARAMETER offset
|
||||||
|
Offset to use
|
||||||
|
|
||||||
|
.PARAMETER all
|
||||||
|
A return all results, works with -offset and other parameters
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-Info command
|
URL of Snipeit system, can be set using Set-Info command
|
||||||
|
|
||||||
|
|
@ -9,10 +24,10 @@ URL of Snipeit system, can be set using Set-Info command
|
||||||
Users API Key for Snipeit, can be set using Set-Info command
|
Users API Key for Snipeit, can be set using Set-Info command
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Get-Models -url "https://assets.example.com" -token "token..."
|
Get-Model -url "https://assets.example.com" -token "token..."
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Get-Models -url "https://assets.example.com" -token "token..." | Where-Object {$_.name -eq "DL380" }
|
Get-Model -url "https://assets.example.com" -token "token..." | Where-Object {$_.name -eq "DL380" }
|
||||||
|
|
||||||
#>
|
#>
|
||||||
|
|
||||||
|
|
@ -21,6 +36,8 @@ function Get-Model()
|
||||||
Param(
|
Param(
|
||||||
[string]$search,
|
[string]$search,
|
||||||
|
|
||||||
|
[int]$id,
|
||||||
|
|
||||||
[ValidateSet("asc", "desc")]
|
[ValidateSet("asc", "desc")]
|
||||||
[string]$order = "desc",
|
[string]$order = "desc",
|
||||||
|
|
||||||
|
|
@ -28,6 +45,8 @@ function Get-Model()
|
||||||
|
|
||||||
[int]$offset,
|
[int]$offset,
|
||||||
|
|
||||||
|
[switch]$all = $false,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $true)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
|
|
@ -35,16 +54,42 @@ function Get-Model()
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
|
||||||
$SearchParameter = . Get-ParameterValue
|
$SearchParameter = . Get-ParameterValue $MyInvocation.MyCommand.Parameters
|
||||||
|
|
||||||
|
$apiurl = "$url/api/v1/models"
|
||||||
|
|
||||||
|
if ($search -and $id ) {
|
||||||
|
Throw "[$($MyInvocation.MyCommand.Name)] Please specify only -search or -id parameter , not both "
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($id) {
|
||||||
|
$apiurl= "$url/api/v1/models/$id"
|
||||||
|
}
|
||||||
|
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/models"
|
Uri = $apiurl
|
||||||
Method = 'Get'
|
Method = 'Get'
|
||||||
Token = $apiKey
|
Token = $apiKey
|
||||||
GetParameters = $SearchParameter
|
GetParameters = $SearchParameter
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
if ($all) {
|
||||||
|
$offstart = $(if($offset){$offset} Else {0})
|
||||||
|
$callargs = $SearchParameter
|
||||||
|
$callargs.Remove('all')
|
||||||
|
|
||||||
$result
|
while ($true) {
|
||||||
|
$callargs['offset'] = $offstart
|
||||||
|
$callargs['limit'] = $limit
|
||||||
|
$res=Get-Model @callargs
|
||||||
|
$res
|
||||||
|
if ($res.count -ne $limit ) {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
$offstart = $offstart + $limit
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
|
$result
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,21 @@
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
# Gets a list of Snipe-it Locations
|
# Gets a list of Snipe-it Locations
|
||||||
|
|
||||||
|
.PARAMETER search
|
||||||
|
A text string to search the Locations data
|
||||||
|
|
||||||
|
.PARAMETER id
|
||||||
|
A id of specific Location
|
||||||
|
|
||||||
|
.PARAMETER limit
|
||||||
|
Specify the number of results you wish to return. Defaults to 50. Defines batch size for -all
|
||||||
|
|
||||||
|
.PARAMETER offset
|
||||||
|
Offset to use
|
||||||
|
|
||||||
|
.PARAMETER all
|
||||||
|
A return all results, works with -offset and other parameters
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-Info command
|
URL of Snipeit system, can be set using Set-Info command
|
||||||
|
|
||||||
|
|
@ -21,6 +36,8 @@ function Get-SnipeitLocation()
|
||||||
Param(
|
Param(
|
||||||
[string]$search,
|
[string]$search,
|
||||||
|
|
||||||
|
[string]$id,
|
||||||
|
|
||||||
[ValidateSet("asc", "desc")]
|
[ValidateSet("asc", "desc")]
|
||||||
[string]$order = "desc",
|
[string]$order = "desc",
|
||||||
|
|
||||||
|
|
@ -28,6 +45,8 @@ function Get-SnipeitLocation()
|
||||||
|
|
||||||
[int]$offset,
|
[int]$offset,
|
||||||
|
|
||||||
|
[switch]$all = $false,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $true)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
|
|
@ -35,17 +54,43 @@ function Get-SnipeitLocation()
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
|
||||||
$SearchParameter = . Get-ParameterValue
|
$SearchParameter = . Get-ParameterValue $MyInvocation.MyCommand.Parameters
|
||||||
|
|
||||||
|
$apiurl = "$url/api/v1/locations"
|
||||||
|
|
||||||
|
if ($search -and $id ) {
|
||||||
|
Throw "[$($MyInvocation.MyCommand.Name)] Please specify only -search or -id parameter , not both "
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($id) {
|
||||||
|
$apiurl= "$url/api/v1/locations/$id"
|
||||||
|
}
|
||||||
|
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/locations"
|
Uri = $apiurl
|
||||||
Method = 'Get'
|
Method = 'Get'
|
||||||
Token = $apiKey
|
Token = $apiKey
|
||||||
GetParameters = $SearchParameter
|
GetParameters = $SearchParameter
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
if ($all) {
|
||||||
|
$offstart = $(if($offset){$offset} Else {0})
|
||||||
|
$callargs = $SearchParameter
|
||||||
|
$callargs.Remove('all')
|
||||||
|
|
||||||
$result
|
while ($true) {
|
||||||
|
$callargs['offset'] = $offstart
|
||||||
|
$callargs['limit'] = $limit
|
||||||
|
$res=Get-SnipeitLocation @callargs
|
||||||
|
$res
|
||||||
|
if ($res.count -lt $limit) {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
$offstart = $offstart + $limit
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
|
$result
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,21 @@
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
# Gets a list of Snipe-it Status Labels
|
# Gets a list of Snipe-it Status Labels
|
||||||
|
|
||||||
|
.PARAMETER search
|
||||||
|
A text string to search the Status Labels data
|
||||||
|
|
||||||
|
.PARAMETER id
|
||||||
|
A id of specific Status Label
|
||||||
|
|
||||||
|
.PARAMETER limit
|
||||||
|
Specify the number of results you wish to return. Defaults to 50. Defines batch size for -all
|
||||||
|
|
||||||
|
.PARAMETER offset
|
||||||
|
Offset to use
|
||||||
|
|
||||||
|
.PARAMETER all
|
||||||
|
A return all results, works with -offset and other parameters
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-Info command
|
URL of Snipeit system, can be set using Set-Info command
|
||||||
|
|
||||||
|
|
@ -21,6 +36,8 @@ function Get-Status()
|
||||||
Param(
|
Param(
|
||||||
[string]$search,
|
[string]$search,
|
||||||
|
|
||||||
|
[string]$id,
|
||||||
|
|
||||||
[ValidateSet("asc", "desc")]
|
[ValidateSet("asc", "desc")]
|
||||||
[string]$order = "desc",
|
[string]$order = "desc",
|
||||||
|
|
||||||
|
|
@ -28,6 +45,8 @@ function Get-Status()
|
||||||
|
|
||||||
[int]$offset,
|
[int]$offset,
|
||||||
|
|
||||||
|
[switch]$all = $false,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $true)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
|
|
@ -35,16 +54,42 @@ function Get-Status()
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
|
||||||
$SearchParameter = . Get-ParameterValue
|
$SearchParameter = . Get-ParameterValue $MyInvocation.MyCommand.Parameters
|
||||||
|
|
||||||
|
$apiurl = "$url/api/v1/statuslabels"
|
||||||
|
|
||||||
|
if ($search -and $id ) {
|
||||||
|
Throw "[$($MyInvocation.MyCommand.Name)] Please specify only -search or -id parameter , not both "
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($id) {
|
||||||
|
$apiurl= "$url/api/v1/statuslabels/$id"
|
||||||
|
}
|
||||||
|
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/statuslabels"
|
Uri = $apiurl
|
||||||
Method = 'Get'
|
Method = 'Get'
|
||||||
Token = $apiKey
|
Token = $apiKey
|
||||||
GetParameters = $SearchParameter
|
GetParameters = $SearchParameter
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
if ($all) {
|
||||||
|
$offstart = $(if($offset){$offset} Else {0})
|
||||||
|
$callargs = $SearchParameter
|
||||||
|
$callargs.Remove('all')
|
||||||
|
|
||||||
$result
|
while ($true) {
|
||||||
|
$callargs['offset'] = $offstart
|
||||||
|
$callargs['limit'] = $limit
|
||||||
|
$res=Get-Status @callargs
|
||||||
|
$res
|
||||||
|
if ($res.count -lt $limit) {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
$offstart = $offstart + $limit
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
|
$result
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,21 @@
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
# Gets a list of Snipe-it Suppliers
|
# Gets a list of Snipe-it Suppliers
|
||||||
|
|
||||||
|
.PARAMETER search
|
||||||
|
A text string to search the Supliers data
|
||||||
|
|
||||||
|
.PARAMETER id
|
||||||
|
A id of specific Suplier
|
||||||
|
|
||||||
|
.PARAMETER limit
|
||||||
|
Specify the number of results you wish to return. Defaults to 50. Defines batch size for -all
|
||||||
|
|
||||||
|
.PARAMETER offset
|
||||||
|
Offset to use
|
||||||
|
|
||||||
|
.PARAMETER all
|
||||||
|
A return all results, works with -offset and other parameters
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-Info command
|
URL of Snipeit system, can be set using Set-Info command
|
||||||
|
|
||||||
|
|
@ -21,6 +36,8 @@ function Get-Supplier()
|
||||||
Param(
|
Param(
|
||||||
[string]$search,
|
[string]$search,
|
||||||
|
|
||||||
|
[string]$id,
|
||||||
|
|
||||||
[ValidateSet("asc", "desc")]
|
[ValidateSet("asc", "desc")]
|
||||||
[string]$order = "desc",
|
[string]$order = "desc",
|
||||||
|
|
||||||
|
|
@ -28,6 +45,8 @@ function Get-Supplier()
|
||||||
|
|
||||||
[int]$offset,
|
[int]$offset,
|
||||||
|
|
||||||
|
[switch]$all = $false,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $true)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
|
|
@ -35,17 +54,43 @@ function Get-Supplier()
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
|
||||||
$SearchParameter = . Get-ParameterValue
|
$SearchParameter = . Get-ParameterValue $MyInvocation.MyCommand.Parameters
|
||||||
|
|
||||||
|
$apiurl = "$url/api/v1/suppliers"
|
||||||
|
|
||||||
|
if ($search -and $id ) {
|
||||||
|
Throw "[$($MyInvocation.MyCommand.Name)] Please specify only -search or -id parameter , not both "
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($id) {
|
||||||
|
$apiurl= "$url/api/v1/suppliers/$id"
|
||||||
|
}
|
||||||
|
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/suppliers"
|
Uri = $apiurl
|
||||||
Method = 'Get'
|
Method = 'Get'
|
||||||
Token = $apiKey
|
Token = $apiKey
|
||||||
GetParameters = $SearchParameter
|
GetParameters = $SearchParameter
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
if ($all) {
|
||||||
|
$offstart = $(if($offset){$offset} Else {0})
|
||||||
|
$callargs = $SearchParameter
|
||||||
|
$callargs.Remove('all')
|
||||||
|
|
||||||
$result
|
while ($true) {
|
||||||
|
$callargs['offset'] = $offstart
|
||||||
|
$callargs['limit'] = $limit
|
||||||
|
$res=Get-Supplier @callargs
|
||||||
|
$res
|
||||||
|
if ($res.count -lt $limit) {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
$offstart = $offstart + $limit
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
|
$result
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,21 @@
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
# Gets a list of Snipe-it Users
|
# Gets a list of Snipe-it Users
|
||||||
|
|
||||||
|
.PARAMETER search
|
||||||
|
A text string to search the User data
|
||||||
|
|
||||||
|
.PARAMETER id
|
||||||
|
A id of specific User
|
||||||
|
|
||||||
|
.PARAMETER limit
|
||||||
|
Specify the number of results you wish to return. Defaults to 50. Defines batch size for -all
|
||||||
|
|
||||||
|
.PARAMETER offset
|
||||||
|
Offset to use
|
||||||
|
|
||||||
|
.PARAMETER all
|
||||||
|
A return all results, works with -offset and other parameters
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-Info command
|
URL of Snipeit system, can be set using Set-Info command
|
||||||
|
|
||||||
|
|
@ -19,6 +34,8 @@ function Get-User() {
|
||||||
Param(
|
Param(
|
||||||
[string]$search,
|
[string]$search,
|
||||||
|
|
||||||
|
[string]$id,
|
||||||
|
|
||||||
[int]$company_id,
|
[int]$company_id,
|
||||||
|
|
||||||
[int]$location_id,
|
[int]$location_id,
|
||||||
|
|
@ -27,6 +44,10 @@ function Get-User() {
|
||||||
|
|
||||||
[int]$department_id,
|
[int]$department_id,
|
||||||
|
|
||||||
|
[string]$username,
|
||||||
|
|
||||||
|
[string]$email,
|
||||||
|
|
||||||
[ValidateSet("asc", "desc")]
|
[ValidateSet("asc", "desc")]
|
||||||
[string]$order = "desc",
|
[string]$order = "desc",
|
||||||
|
|
||||||
|
|
@ -34,6 +55,8 @@ function Get-User() {
|
||||||
|
|
||||||
[int]$offset,
|
[int]$offset,
|
||||||
|
|
||||||
|
[switch]$all = $false,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $true)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
|
|
@ -41,16 +64,41 @@ function Get-User() {
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
|
||||||
$SearchParameter = . Get-ParameterValue
|
$SearchParameter = . Get-ParameterValue $MyInvocation.MyCommand.Parameters
|
||||||
|
|
||||||
|
$apiurl = "$url/api/v1/users"
|
||||||
|
|
||||||
|
if ($search -and $id ) {
|
||||||
|
Throw "[$($MyInvocation.MyCommand.Name)] Please specify only -search or -id parameter , not both "
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($id) {
|
||||||
|
$apiurl= "$url/api/v1/users/$id"
|
||||||
|
}
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/users"
|
Uri = $apiurl
|
||||||
Method = 'Get'
|
Method = 'Get'
|
||||||
GetParameters = $SearchParameter
|
GetParameters = $SearchParameter
|
||||||
Token = $apiKey
|
Token = $apiKey
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
if ($all) {
|
||||||
|
$offstart = $(if($offset){$offset} Else {0})
|
||||||
|
$callargs = $SearchParameter
|
||||||
|
$callargs.Remove('all')
|
||||||
|
|
||||||
$result
|
while ($true) {
|
||||||
|
$callargs['offset'] = $offstart
|
||||||
|
$callargs['limit'] = $limit
|
||||||
|
$res=Get-User @callargs
|
||||||
|
$res
|
||||||
|
if ($res.count -lt $limit) {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
$offstart = $offstart + $limit
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
|
$result
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ function New-Accessory() {
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
|
||||||
$Values = . Get-ParameterValue
|
$Values = . Get-ParameterValue $MyInvocation.MyCommand.Parameters
|
||||||
|
|
||||||
if ($values['purchase_date']) {
|
if ($values['purchase_date']) {
|
||||||
$values['purchase_date'] = $values['purchase_date'].ToString("yyyy-MM-dd")
|
$values['purchase_date'] = $values['purchase_date'].ToString("yyyy-MM-dd")
|
||||||
|
|
|
||||||
|
|
@ -5,17 +5,42 @@
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
Long description
|
Long description
|
||||||
|
|
||||||
.PARAMETER Tag
|
|
||||||
Asset Tag for the Asset
|
|
||||||
|
|
||||||
.PARAMETER Name
|
.PARAMETER status_id
|
||||||
Name of the Asset
|
Required Status ID of the asset, this can be got using Get-Status
|
||||||
|
|
||||||
.PARAMETER Status_id
|
.PARAMETER model_id
|
||||||
Status ID of the asset, this can be got using Get-Status
|
Required Model ID of the asset, this can be got using Get-Model
|
||||||
|
|
||||||
.PARAMETER Model_id
|
.PARAMETER name
|
||||||
Model ID of the asset, this can be got using Get-Model
|
Optional Name of the Asset
|
||||||
|
|
||||||
|
.PARAMETER asset_tag
|
||||||
|
Asset Tag for the Asset, not required when snipe asset_tag autogeneration is on.
|
||||||
|
|
||||||
|
.PARAMETER serial
|
||||||
|
Optional Serial number of the Asset
|
||||||
|
|
||||||
|
.PARAMETER company_id
|
||||||
|
Optional Company id
|
||||||
|
|
||||||
|
.PARAMETER order_number
|
||||||
|
Optional Order number
|
||||||
|
|
||||||
|
.PARAMETER notes
|
||||||
|
Optional Notes
|
||||||
|
|
||||||
|
.PARAMETER warranty_monhts
|
||||||
|
Optional Warranty lenght of the Asset in months
|
||||||
|
|
||||||
|
.PARAMETER purchase_cost
|
||||||
|
Optional Purchase cost of the Asset
|
||||||
|
|
||||||
|
.PARAMETER purchase_date
|
||||||
|
Optional Purchase cost of the Asset
|
||||||
|
|
||||||
|
.PARAMETER rtd_location_id
|
||||||
|
Optional Default location id for the asset
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-Info command
|
URL of Snipeit system, can be set using Set-Info command
|
||||||
|
|
@ -41,16 +66,46 @@ function New-Asset()
|
||||||
)]
|
)]
|
||||||
|
|
||||||
Param(
|
Param(
|
||||||
[string]$tag,
|
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $true)]
|
||||||
[string]$Name,
|
[int]$status_id,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $true)]
|
||||||
[int]$Status_id,
|
[int]$model_id,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[int]$Model_id,
|
[string]$name,
|
||||||
|
|
||||||
|
[parameter(mandatory = $false)]
|
||||||
|
[Alias('tag')]
|
||||||
|
[string]$asset_tag,
|
||||||
|
|
||||||
|
[parameter(mandatory = $false)]
|
||||||
|
[string]$serial,
|
||||||
|
|
||||||
|
[parameter(mandatory = $false)]
|
||||||
|
[int]$company_id,
|
||||||
|
|
||||||
|
[parameter(mandatory = $false)]
|
||||||
|
[string]$order_number,
|
||||||
|
|
||||||
|
[parameter(mandatory = $false)]
|
||||||
|
[string]$notes,
|
||||||
|
|
||||||
|
[parameter(mandatory = $false)]
|
||||||
|
[int]$warranty_months,
|
||||||
|
|
||||||
|
[parameter(mandatory = $false)]
|
||||||
|
[string]$purchase_cost,
|
||||||
|
|
||||||
|
[parameter(mandatory = $false)]
|
||||||
|
[string]$purchase_date,
|
||||||
|
|
||||||
|
[parameter(mandatory = $false)]
|
||||||
|
[int]$supplier_id,
|
||||||
|
|
||||||
|
[parameter(mandatory = $false)]
|
||||||
|
[int]$rtd_location_id,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $true)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
@ -61,16 +116,8 @@ function New-Asset()
|
||||||
[hashtable] $customfields
|
[hashtable] $customfields
|
||||||
)
|
)
|
||||||
|
|
||||||
$Values = @{
|
$Values = . Get-ParameterValue $MyInvocation.MyCommand.Parameters
|
||||||
"name" = $Name
|
|
||||||
"status_id" = $status_id
|
|
||||||
"model_id" = $model_id
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($PSBoundParameters.ContainsKey('tag'))
|
|
||||||
{
|
|
||||||
$Values += @{"asset_tag" = $tag}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($customfields)
|
if ($customfields)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ function New-AssetMaintenance() {
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
|
||||||
$Values = . Get-ParameterValue
|
$Values = . Get-ParameterValue $MyInvocation.MyCommand.Parameters
|
||||||
|
|
||||||
if ($values['start_date']) {
|
if ($values['start_date']) {
|
||||||
$values['start_date'] = $values['start_date'].ToString("yyyy-MM-dd")
|
$values['start_date'] = $values['start_date'].ToString("yyyy-MM-dd")
|
||||||
|
|
|
||||||
82
SnipeitPS/Public/New-Category.ps1
Normal file
82
SnipeitPS/Public/New-Category.ps1
Normal file
|
|
@ -0,0 +1,82 @@
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
# Create a new Snipe-IT Category
|
||||||
|
.PARAMETER name
|
||||||
|
Name of new category to be created
|
||||||
|
.PARAMETER type
|
||||||
|
Type of new category to be created (asset, accessory, consumable, component, license)
|
||||||
|
.PARAMETER url
|
||||||
|
URL of Snipeit system, can be set using Set-Info command
|
||||||
|
.PARAMETER apiKey
|
||||||
|
User's API Key for Snipeit, can be set using Set-Info command
|
||||||
|
.PARAMETER use_default_eula
|
||||||
|
If switch is present, use the primary default EULA
|
||||||
|
.PARAMETER require_acceptance
|
||||||
|
If switch is present, require users to confirm acceptance of assets in this category
|
||||||
|
.PARAMETER checkin_email
|
||||||
|
If switch is present, send email to user on checkin/checkout
|
||||||
|
.EXAMPLE
|
||||||
|
New-Category -name "Laptops" -category_type asset -url "Snipe-IT URL here..." -apiKey "API key here..."
|
||||||
|
#>
|
||||||
|
|
||||||
|
function New-Category()
|
||||||
|
{
|
||||||
|
[CmdletBinding(
|
||||||
|
SupportsShouldProcess = $true,
|
||||||
|
ConfirmImpact = "Low"
|
||||||
|
)]
|
||||||
|
|
||||||
|
Param(
|
||||||
|
[parameter(mandatory = $true)]
|
||||||
|
[string]$name,
|
||||||
|
|
||||||
|
[parameter(mandatory = $true)]
|
||||||
|
[ValidateSet("asset", "accessory", "consumable", "component", "license")]
|
||||||
|
[string]$category_type,
|
||||||
|
|
||||||
|
[parameter(mandatory = $true)]
|
||||||
|
[string]$url,
|
||||||
|
|
||||||
|
[parameter(mandatory = $true)]
|
||||||
|
[string]$apiKey,
|
||||||
|
|
||||||
|
[switch]$use_default_eula,
|
||||||
|
|
||||||
|
[switch]$require_acceptance,
|
||||||
|
|
||||||
|
[switch]$checkin_email
|
||||||
|
)
|
||||||
|
|
||||||
|
$Values = @{
|
||||||
|
"name" = $name
|
||||||
|
"category_type" = $category_type
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($use_default_eula) {
|
||||||
|
$Values += @{"use_default_eula" = $true}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($require_acceptance) {
|
||||||
|
$Values += @{"require_acceptance" = $true}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($checkin_email) {
|
||||||
|
$Values += @{"checkin_email" = $true}
|
||||||
|
}
|
||||||
|
|
||||||
|
$Body = $Values | ConvertTo-Json;
|
||||||
|
|
||||||
|
$Parameters = @{
|
||||||
|
Uri = "$url/api/v1/categories"
|
||||||
|
Method = 'POST'
|
||||||
|
Body = $Body
|
||||||
|
Token = $apiKey
|
||||||
|
}
|
||||||
|
|
||||||
|
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
|
||||||
|
{
|
||||||
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
|
}
|
||||||
|
|
||||||
|
$result
|
||||||
|
}
|
||||||
|
|
@ -39,7 +39,7 @@ function New-Company()
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
|
||||||
$Values = . Get-ParameterValue
|
$Values = . Get-ParameterValue $MyInvocation.MyCommand.Parameters
|
||||||
|
|
||||||
$Body = $Values | ConvertTo-Json;
|
$Body = $Values | ConvertTo-Json;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ function New-Component() {
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
|
||||||
$Values = . Get-ParameterValue
|
$Values = . Get-ParameterValue $MyInvocation.MyCommand.Parameters
|
||||||
|
|
||||||
if ($values['purchase_date']) {
|
if ($values['purchase_date']) {
|
||||||
$values['purchase_date'] = $values['purchase_date'].ToString("yyyy-MM-dd")
|
$values['purchase_date'] = $values['purchase_date'].ToString("yyyy-MM-dd")
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ function New-CustomField()
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
|
||||||
$Values = . Get-ParameterValue
|
$Values = . Get-ParameterValue $MyInvocation.MyCommand.Parameters
|
||||||
|
|
||||||
#Convert Values to JSON format
|
#Convert Values to JSON format
|
||||||
$Body = $Values | ConvertTo-Json;
|
$Body = $Values | ConvertTo-Json;
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ function New-Department() {
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
|
||||||
$Values = . Get-ParameterValue
|
$Values = . Get-ParameterValue $MyInvocation.MyCommand.Parameters
|
||||||
|
|
||||||
$Body = $Values | ConvertTo-Json;
|
$Body = $Values | ConvertTo-Json;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ function New-License() {
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
|
||||||
$Values = . Get-ParameterValue
|
$Values = . Get-ParameterValue $MyInvocation.MyCommand.Parameters
|
||||||
|
|
||||||
if ($values['expiration_date']) {
|
if ($values['expiration_date']) {
|
||||||
$values['expiration_date'] = $values['expiration_date'].ToString("yyyy-MM-dd")
|
$values['expiration_date'] = $values['expiration_date'].ToString("yyyy-MM-dd")
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,39 @@
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Add a new Model to Snipe-it asset system
|
Add a new Location to Snipe-it asset system
|
||||||
|
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
Long description
|
Long description
|
||||||
|
|
||||||
.PARAMETER name
|
.PARAMETER name
|
||||||
Name of the Asset Model
|
Name of the Location
|
||||||
|
|
||||||
.PARAMETER category_id
|
.PARAMETER address
|
||||||
Category ID that the asset belongs to this can be got using Get-Category
|
Address line 1 of the location
|
||||||
|
|
||||||
.PARAMETER manufacturer_id
|
.PARAMETER address2
|
||||||
Manufacturer ID that the asset belongs to this can be got using Get-Manufacturer
|
Address line 2 of the location
|
||||||
|
|
||||||
.PARAMETER fieldset_id
|
.PARAMETER state
|
||||||
Fieldset ID that the asset uses (Custom fields)
|
Address State of the location
|
||||||
|
|
||||||
|
.PARAMETER country
|
||||||
|
Country of the location
|
||||||
|
|
||||||
|
.PARAMETER zip
|
||||||
|
The zip code of the location
|
||||||
|
|
||||||
|
.PARAMETER ldap_ou
|
||||||
|
The LDAP OU of the location
|
||||||
|
|
||||||
|
.PARAMETER parent_id
|
||||||
|
Parent location ID for the location
|
||||||
|
|
||||||
|
.PARAMETER currency
|
||||||
|
Currency used at the location
|
||||||
|
|
||||||
|
.PARAMETER manager_id
|
||||||
|
The manager ID of the location
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-Info command
|
URL of Snipeit system, can be set using Set-Info command
|
||||||
|
|
@ -24,7 +42,7 @@
|
||||||
Users API Key for Snipeit, can be set using Set-Info command
|
Users API Key for Snipeit, can be set using Set-Info command
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
New-Model -name "DL380" -manufacturer_id 2 -fieldset_id 2 -category_id 1
|
New-Location -name "Room 1" -address "123 Asset Street" -parent_id 14
|
||||||
#>
|
#>
|
||||||
|
|
||||||
function New-Location() {
|
function New-Location() {
|
||||||
|
|
@ -47,6 +65,8 @@ function New-Location() {
|
||||||
|
|
||||||
[string]$zip,
|
[string]$zip,
|
||||||
|
|
||||||
|
[int]$parent_id,
|
||||||
|
|
||||||
[int]$manager_id,
|
[int]$manager_id,
|
||||||
|
|
||||||
[string]$ldap_ou,
|
[string]$ldap_ou,
|
||||||
|
|
@ -58,7 +78,7 @@ function New-Location() {
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
|
||||||
$Values = . Get-ParameterValue
|
$Values = . Get-ParameterValue $MyInvocation.MyCommand.Parameters
|
||||||
|
|
||||||
$Body = $Values | ConvertTo-Json;
|
$Body = $Values | ConvertTo-Json;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,16 +5,22 @@
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
Long description
|
Long description
|
||||||
|
|
||||||
.PARAMETER firstName
|
.PARAMETER first_name
|
||||||
Parameter description
|
Parameter description
|
||||||
|
|
||||||
.PARAMETER lastName
|
.PARAMETER last_name
|
||||||
Parameter description
|
Parameter description
|
||||||
|
|
||||||
.PARAMETER userName
|
.PARAMETER username
|
||||||
Parameter description
|
Parameter description
|
||||||
|
|
||||||
.PARAMETER jobTitle
|
.PARAMETER active
|
||||||
|
Parameter description
|
||||||
|
|
||||||
|
.PARAMETER notes
|
||||||
|
Parameter description
|
||||||
|
|
||||||
|
.PARAMETER jobtitle
|
||||||
Parameter description
|
Parameter description
|
||||||
|
|
||||||
.PARAMETER email
|
.PARAMETER email
|
||||||
|
|
@ -38,8 +44,8 @@
|
||||||
.PARAMETER employee_num
|
.PARAMETER employee_num
|
||||||
Parameter description
|
Parameter description
|
||||||
|
|
||||||
.PARAMETER ldap_user
|
.PARAMETER ldap_import
|
||||||
Parameter description
|
Mark user as import from ldap
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
Parameter description
|
Parameter description
|
||||||
|
|
@ -62,17 +68,21 @@ function New-User() {
|
||||||
|
|
||||||
Param(
|
Param(
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $true)]
|
||||||
[string]$firstName,
|
[string]$first_name,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $true)]
|
||||||
[string]$lastName,
|
[string]$last_name,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $true)]
|
||||||
[string]$userName,
|
[string]$username,
|
||||||
|
|
||||||
[string]$password,
|
[string]$password,
|
||||||
|
|
||||||
[string]$jobTitle,
|
[bool]$activated = $false,
|
||||||
|
|
||||||
|
[string]$notes,
|
||||||
|
|
||||||
|
[string]$jobtitle,
|
||||||
|
|
||||||
[string]$email,
|
[string]$email,
|
||||||
|
|
||||||
|
|
@ -88,7 +98,8 @@ function New-User() {
|
||||||
|
|
||||||
[string]$employee_num,
|
[string]$employee_num,
|
||||||
|
|
||||||
[bool]$ldap_user = $false,
|
[bool]$ldap_import = $false,
|
||||||
|
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $true)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
@ -97,36 +108,10 @@ function New-User() {
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
|
||||||
$Values = @{
|
$Values = . Get-ParameterValue $MyInvocation.MyCommand.Parameters
|
||||||
first_name = $firstName
|
|
||||||
last_name = $lastName
|
|
||||||
username = $userName
|
|
||||||
|
|
||||||
email = $email
|
if ($password ) {
|
||||||
phone = $phone
|
$Values['password_confirmation'] = $password
|
||||||
company_id = $company_id
|
|
||||||
location_id = $location_id
|
|
||||||
department_id = $department_id
|
|
||||||
manager_id = $manager_id
|
|
||||||
jobtitle = $jobTitle
|
|
||||||
employee_num = $employee_num
|
|
||||||
notes = "Imported using SnipeitPS Script"
|
|
||||||
activated = 1
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($ldap_user -eq $false) {
|
|
||||||
$ldap = @{
|
|
||||||
password = $password
|
|
||||||
password_confirmation = $password
|
|
||||||
ldap_import = 0
|
|
||||||
}
|
|
||||||
$Values += $ldap
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$ldap = @{
|
|
||||||
ldap_import = 1
|
|
||||||
}
|
|
||||||
$Values += $ldap
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$Body = $Values | ConvertTo-Json;
|
$Body = $Values | ConvertTo-Json;
|
||||||
|
|
|
||||||
52
SnipeitPS/Public/Remove-AssetMaintenance.ps1
Normal file
52
SnipeitPS/Public/Remove-AssetMaintenance.ps1
Normal file
|
|
@ -0,0 +1,52 @@
|
||||||
|
function Remove-AssetMaintenance {
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Remove asset maintenance from Snipe-it asset system
|
||||||
|
.DESCRIPTION
|
||||||
|
Removes asset maintenance event from Snipe-it asset system by ID
|
||||||
|
.PARAMETER ID
|
||||||
|
Unique ID of the asset maintenance to be removed
|
||||||
|
.EXAMPLE
|
||||||
|
Remove-AssetMaintenance -ID 44 -url $url -apiKey $secret -Verbose
|
||||||
|
#>
|
||||||
|
[CmdletBinding(
|
||||||
|
SupportsShouldProcess = $true,
|
||||||
|
ConfirmImpact = "Low"
|
||||||
|
)]
|
||||||
|
param (
|
||||||
|
# Asset maintenance ID
|
||||||
|
[Parameter(Mandatory = $true)]
|
||||||
|
[string]
|
||||||
|
$ID,
|
||||||
|
|
||||||
|
# SnipeIt URL
|
||||||
|
[Parameter(Mandatory = $true)]
|
||||||
|
[string]
|
||||||
|
$url,
|
||||||
|
|
||||||
|
# SnipeIt ApiKey
|
||||||
|
[Parameter(Mandatory = $true)]
|
||||||
|
[string]
|
||||||
|
$apiKey
|
||||||
|
)
|
||||||
|
|
||||||
|
$Values = @{
|
||||||
|
"ID" = $ID
|
||||||
|
}
|
||||||
|
|
||||||
|
$Body = $Values | ConvertTo-Json
|
||||||
|
|
||||||
|
$Parameters = @{
|
||||||
|
Uri = "$url/api/v1/maintenances/$ID"
|
||||||
|
Method = 'Delete'
|
||||||
|
Body = $Body
|
||||||
|
Token = $apiKey
|
||||||
|
}
|
||||||
|
|
||||||
|
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
|
||||||
|
{
|
||||||
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
|
}
|
||||||
|
|
||||||
|
$result
|
||||||
|
}
|
||||||
48
SnipeitPS/Public/Remove-User.ps1
Normal file
48
SnipeitPS/Public/Remove-User.ps1
Normal file
|
|
@ -0,0 +1,48 @@
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Removes User from Snipe-it asset system
|
||||||
|
.DESCRIPTION
|
||||||
|
Long description
|
||||||
|
.PARAMETER ID
|
||||||
|
Unique ID For User to be removed
|
||||||
|
.EXAMPLE
|
||||||
|
Remove-User -ID 44 -url $url -apiKey $secret -Verbose
|
||||||
|
#>
|
||||||
|
|
||||||
|
function Remove-User ()
|
||||||
|
{
|
||||||
|
[CmdletBinding(
|
||||||
|
SupportsShouldProcess = $true,
|
||||||
|
ConfirmImpact = "Low"
|
||||||
|
)]
|
||||||
|
|
||||||
|
Param(
|
||||||
|
[parameter(mandatory = $true)]
|
||||||
|
[string]$ID,
|
||||||
|
[parameter(mandatory = $true)]
|
||||||
|
[string]$URL,
|
||||||
|
[parameter(mandatory = $true)]
|
||||||
|
[string]$APIKey
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
$Values = @{
|
||||||
|
"ID" = $ID
|
||||||
|
}
|
||||||
|
|
||||||
|
$Body = $Values | ConvertTo-Json
|
||||||
|
|
||||||
|
$Parameters = @{
|
||||||
|
Uri = "$url/api/v1/users/$ID"
|
||||||
|
Method = 'Delete'
|
||||||
|
Body = $Body
|
||||||
|
Token = $apiKey
|
||||||
|
}
|
||||||
|
|
||||||
|
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
|
||||||
|
{
|
||||||
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
|
}
|
||||||
|
|
||||||
|
$result
|
||||||
|
}
|
||||||
|
|
@ -41,7 +41,7 @@ function Set-Accessory() {
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
|
||||||
$Values = . Get-ParameterValue
|
$Values = . Get-ParameterValue $MyInvocation.MyCommand.Parameters
|
||||||
|
|
||||||
if ($values['purchase_date']) {
|
if ($values['purchase_date']) {
|
||||||
$values['purchase_date'] = $values['purchase_date'].ToString("yyyy-MM-dd")
|
$values['purchase_date'] = $values['purchase_date'].ToString("yyyy-MM-dd")
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Update a Asset in the Snipe-it asset system
|
Update a specific Asset in the Snipe-it asset system
|
||||||
|
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
Long description
|
Long description
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
ID of the Asset
|
ID of the Asset
|
||||||
|
|
||||||
.PARAMETER Name
|
.PARAMETER Name
|
||||||
Name of the Asset
|
Asset name
|
||||||
|
|
||||||
.PARAMETER Status_id
|
.PARAMETER 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
|
||||||
|
|
@ -17,6 +17,39 @@
|
||||||
.PARAMETER Model_id
|
.PARAMETER 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
|
||||||
|
|
||||||
|
.PARAMETER last_checkout
|
||||||
|
Date the asset was last checked out
|
||||||
|
|
||||||
|
.PARAMETER assigned_to
|
||||||
|
The id of the user the asset is currently checked out to
|
||||||
|
|
||||||
|
.PARAMETER company_id
|
||||||
|
The id of an associated company id
|
||||||
|
|
||||||
|
.PARAMETER serial
|
||||||
|
Serial number of the asset
|
||||||
|
|
||||||
|
.PARAMETER order_number
|
||||||
|
Order number for the asset
|
||||||
|
|
||||||
|
.PARAMETER warranty_months
|
||||||
|
Number of months for the asset warranty
|
||||||
|
|
||||||
|
.PARAMETER purchase_cost
|
||||||
|
Purchase cost of the asset, without a currency symbol
|
||||||
|
|
||||||
|
.PARAMETER purchase_date
|
||||||
|
Date of asset purchase
|
||||||
|
|
||||||
|
.PARAMETER requestable
|
||||||
|
Whether or not the asset can be requested by users with the permission to request assets
|
||||||
|
|
||||||
|
.PARAMETER archived
|
||||||
|
Whether or not the asset is archived. Archived assets cannot be checked out and do not show up in the deployable asset screens
|
||||||
|
|
||||||
|
.PARAMETER rtd_location_id
|
||||||
|
The id that corresponds to the location where the asset is usually located when not checked out
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-Info command
|
URL of Snipeit system, can be set using Set-Info command
|
||||||
|
|
||||||
|
|
@ -50,6 +83,28 @@ function Set-Asset()
|
||||||
|
|
||||||
[string]$Model_id,
|
[string]$Model_id,
|
||||||
|
|
||||||
|
[DateTime]$last_checkout,
|
||||||
|
|
||||||
|
[int]$assigned_to,
|
||||||
|
|
||||||
|
[int]$company_id,
|
||||||
|
|
||||||
|
[string]$serial,
|
||||||
|
|
||||||
|
[string]$order_number,
|
||||||
|
|
||||||
|
[int]$warranty_months,
|
||||||
|
|
||||||
|
[double]$purchase_cost,
|
||||||
|
|
||||||
|
[DateTime]$purchase_date,
|
||||||
|
|
||||||
|
[bool]$requestable,
|
||||||
|
|
||||||
|
[bool]$archived,
|
||||||
|
|
||||||
|
[int]$rtd_location_id,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $true)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
|
|
@ -59,11 +114,9 @@ function Set-Asset()
|
||||||
[hashtable] $customfields
|
[hashtable] $customfields
|
||||||
)
|
)
|
||||||
|
|
||||||
$Values = @{
|
$Values = . Get-ParameterValue $MyInvocation.MyCommand.Parameters
|
||||||
"name" = $Name
|
|
||||||
"status_id" = $status_id
|
if ($model_id) { $Values.Add('model_id',$model_id)}
|
||||||
"model_id" = $model_id
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($customfields)
|
if ($customfields)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ function Set-AssetOwner()
|
||||||
)
|
)
|
||||||
|
|
||||||
$Values = @{
|
$Values = @{
|
||||||
"id" = $assigned_id
|
"id" = $id
|
||||||
"checkout_to_type" = $checkout_to_type
|
"checkout_to_type" = $checkout_to_type
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ function Set-Component()
|
||||||
$Body = $Values | ConvertTo-Json;
|
$Body = $Values | ConvertTo-Json;
|
||||||
|
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/components/$component_id"
|
Uri = "$url/api/v1/components/$id"
|
||||||
Method = 'Patch'
|
Method = 'Patch'
|
||||||
Body = $Body
|
Body = $Body
|
||||||
Token = $apiKey
|
Token = $apiKey
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ function Set-License() {
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
|
||||||
$Values = . Get-ParameterValue
|
$Values = . Get-ParameterValue $MyInvocation.MyCommand.Parameters
|
||||||
|
|
||||||
if ($values['expiration_date']) {
|
if ($values['expiration_date']) {
|
||||||
$values['expiration_date'] = $values['expiration_date'].ToString("yyyy-MM-dd")
|
$values['expiration_date'] = $values['expiration_date'].ToString("yyyy-MM-dd")
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ function Set-Model() {
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
|
||||||
$Values = . Get-ParameterValue
|
$Values = . Get-ParameterValue $MyInvocation.MyCommand.Parameters
|
||||||
|
|
||||||
$Body = $Values | ConvertTo-Json;
|
$Body = $Values | ConvertTo-Json;
|
||||||
|
|
||||||
|
|
|
||||||
102
SnipeitPS/Public/Set-SnipeitLocation.ps1
Normal file
102
SnipeitPS/Public/Set-SnipeitLocation.ps1
Normal file
|
|
@ -0,0 +1,102 @@
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Updates Location in Snipe-it asset system
|
||||||
|
|
||||||
|
.DESCRIPTION
|
||||||
|
Long description
|
||||||
|
|
||||||
|
.PARAMETER name
|
||||||
|
Name of Location
|
||||||
|
|
||||||
|
.PARAMETER address
|
||||||
|
Address line 1
|
||||||
|
|
||||||
|
.PARAMETER address2
|
||||||
|
Address line 2
|
||||||
|
|
||||||
|
.PARAMETER state
|
||||||
|
Address State
|
||||||
|
|
||||||
|
.PARAMETER country
|
||||||
|
Address Contry
|
||||||
|
|
||||||
|
.PARAMETER zip
|
||||||
|
Address zipcode
|
||||||
|
|
||||||
|
.PARAMETER state
|
||||||
|
Address State
|
||||||
|
|
||||||
|
.PARAMETER manager_id
|
||||||
|
Location manager as id
|
||||||
|
|
||||||
|
.PARAMETER ldap_ou
|
||||||
|
LDAP OU of Location
|
||||||
|
|
||||||
|
.PARAMETER parent_id
|
||||||
|
Parent location as id
|
||||||
|
|
||||||
|
.PARAMETER url
|
||||||
|
URL of Snipeit system, can be set using Set-Info command
|
||||||
|
|
||||||
|
.PARAMETER apiKey
|
||||||
|
Users API Key for Snipeit, can be set using Set-Info command
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
Set-SnipeitLocation -id 123 -name "Some storage" -parent_id 100
|
||||||
|
|
||||||
|
|
||||||
|
#>
|
||||||
|
function Set-SnipeitLocation() {
|
||||||
|
[CmdletBinding(
|
||||||
|
SupportsShouldProcess = $true,
|
||||||
|
ConfirmImpact = "Low"
|
||||||
|
)]
|
||||||
|
|
||||||
|
Param(
|
||||||
|
[parameter(mandatory = $true)]
|
||||||
|
[int]$id,
|
||||||
|
|
||||||
|
[ValidateLength(3, 255)]
|
||||||
|
[string]$name,
|
||||||
|
|
||||||
|
[string]$address,
|
||||||
|
|
||||||
|
[string]$address2,
|
||||||
|
|
||||||
|
[string]$state,
|
||||||
|
|
||||||
|
[string]$country,
|
||||||
|
|
||||||
|
[string]$zip,
|
||||||
|
|
||||||
|
[int]$manager_id,
|
||||||
|
|
||||||
|
[string]$ldap_ou,
|
||||||
|
|
||||||
|
[int]$parent_id,
|
||||||
|
|
||||||
|
[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/locations/$id"
|
||||||
|
Method = 'PUT'
|
||||||
|
Body = $Body
|
||||||
|
Token = $apiKey
|
||||||
|
}
|
||||||
|
|
||||||
|
If ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
||||||
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
|
}
|
||||||
|
|
||||||
|
$result
|
||||||
|
}
|
||||||
|
|
||||||
Binary file not shown.
|
|
@ -14,7 +14,7 @@ environment:
|
||||||
PSGalleryAPIKey:
|
PSGalleryAPIKey:
|
||||||
secure: UdM6qhf5B0G8liHhUrwWERCZr44iSqmg4jUq0lwlTjZs4KyeoiwnBzdej0phqIAm
|
secure: UdM6qhf5B0G8liHhUrwWERCZr44iSqmg4jUq0lwlTjZs4KyeoiwnBzdej0phqIAm
|
||||||
|
|
||||||
version: 1.0.{build}
|
version: 1.1.{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
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue