mirror of
https://github.com/snazy2000/SnipeitPS.git
synced 2025-12-13 18:02:30 +00:00
Merge pull request #152 from snazy2000/develop
Specify default parameter sets and list audits
This commit is contained in:
commit
19fb68fc6d
32 changed files with 142 additions and 84 deletions
|
|
@ -35,6 +35,7 @@ Get-SnipeitAccessory -id 1
|
||||||
#>
|
#>
|
||||||
|
|
||||||
function Get-SnipeitAccessory() {
|
function Get-SnipeitAccessory() {
|
||||||
|
[CmdletBinding(DefaultParameterSetName = 'Search')]
|
||||||
Param(
|
Param(
|
||||||
[parameter(ParameterSetName='Search')]
|
[parameter(ParameterSetName='Search')]
|
||||||
[string]$search,
|
[string]$search,
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,12 @@ Exact asset tag to query
|
||||||
.PARAMETER asset_serial
|
.PARAMETER asset_serial
|
||||||
Exact asset serialnumber to query
|
Exact asset serialnumber to query
|
||||||
|
|
||||||
|
.PARAMETER audit_due
|
||||||
|
Retrieve a list of assets that are due for auditing soon.
|
||||||
|
|
||||||
|
.PARAMETER audit_overdue
|
||||||
|
Retrieve a list of assets that are overdue for auditing.
|
||||||
|
|
||||||
.PARAMETER order_number
|
.PARAMETER order_number
|
||||||
Optionally restrict asset results to this order number
|
Optionally restrict asset results to this order number
|
||||||
|
|
||||||
|
|
@ -73,6 +79,7 @@ Get-SnipeitAsset -asset_tag "myAssetTag"-url "https://assets.example.com"-token
|
||||||
#>
|
#>
|
||||||
|
|
||||||
function Get-SnipeitAsset() {
|
function Get-SnipeitAsset() {
|
||||||
|
[CmdletBinding(DefaultParameterSetName = 'Search')]
|
||||||
Param(
|
Param(
|
||||||
[parameter(ParameterSetName='Search')]
|
[parameter(ParameterSetName='Search')]
|
||||||
[string]$search,
|
[string]$search,
|
||||||
|
|
@ -87,6 +94,12 @@ function Get-SnipeitAsset() {
|
||||||
[Alias('asset_serial')]
|
[Alias('asset_serial')]
|
||||||
[string]$serial,
|
[string]$serial,
|
||||||
|
|
||||||
|
[parameter(ParameterSetName='Assets due auditing soon')]
|
||||||
|
[switch]$audit_due,
|
||||||
|
|
||||||
|
[parameter(ParameterSetName='Assets overdue for auditing')]
|
||||||
|
[switch]$audit_overdue,
|
||||||
|
|
||||||
[parameter(ParameterSetName='Search')]
|
[parameter(ParameterSetName='Search')]
|
||||||
[string]$order_number,
|
[string]$order_number,
|
||||||
|
|
||||||
|
|
@ -118,57 +131,52 @@ function Get-SnipeitAsset() {
|
||||||
[int]$status_id,
|
[int]$status_id,
|
||||||
|
|
||||||
[parameter(ParameterSetName='Search')]
|
[parameter(ParameterSetName='Search')]
|
||||||
[string]$sort = "created_at",
|
[parameter(ParameterSetName='Assets due auditing soon')]
|
||||||
|
[parameter(ParameterSetName='Assets overdue for auditing')]
|
||||||
|
[ValidateSet('id','created_at','asset_tag','serial','order_number','model_id','category_id','manufacturer_id','company_id','location_id','status','status_id')]
|
||||||
|
[string]$sort,
|
||||||
|
|
||||||
[parameter(ParameterSetName='Search')]
|
[parameter(ParameterSetName='Search')]
|
||||||
|
[parameter(ParameterSetName='Assets due auditing soon')]
|
||||||
|
[parameter(ParameterSetName='Assets overdue for auditing')]
|
||||||
[ValidateSet("asc", "desc")]
|
[ValidateSet("asc", "desc")]
|
||||||
[string]$order = "desc",
|
[string]$order,
|
||||||
|
|
||||||
[parameter(ParameterSetName='Search')]
|
[parameter(ParameterSetName='Search')]
|
||||||
|
[parameter(ParameterSetName='Assets due auditing soon')]
|
||||||
|
[parameter(ParameterSetName='Assets overdue for auditing')]
|
||||||
[int]$limit = 50,
|
[int]$limit = 50,
|
||||||
|
|
||||||
[parameter(ParameterSetName='Search')]
|
[parameter(ParameterSetName='Search')]
|
||||||
|
[parameter(ParameterSetName='Assets due auditing soon')]
|
||||||
|
[parameter(ParameterSetName='Assets overdue for auditing')]
|
||||||
[int]$offset,
|
[int]$offset,
|
||||||
|
|
||||||
[parameter(ParameterSetName='Search')]
|
[parameter(ParameterSetName='Search')]
|
||||||
|
[parameter(ParameterSetName='Assets due auditing soon')]
|
||||||
|
[parameter(ParameterSetName='Assets overdue for auditing')]
|
||||||
[switch]$all = $false,
|
[switch]$all = $false,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $true)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $true)]
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
|
||||||
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
||||||
|
|
||||||
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
|
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
|
||||||
|
|
||||||
|
switch ($PsCmdlet.ParameterSetName) {
|
||||||
$apiurl = "$url/api/v1/hardware"
|
'Search' { $apiurl = "$url/api/v1/hardware" }
|
||||||
|
'Get with id' {$apiurl= "$url/api/v1/hardware/$id"}
|
||||||
if ($search -and ($asset_tag -or $asset_serial -or $id)) {
|
'Get with asset tag' {$apiurl= "$url/api/v1/hardware/bytag/$asset_tag"}
|
||||||
Throw "[$($MyInvocation.MyCommand.Name)] Please specify only one of -search , -asset_tag or -asset_serial parameter"
|
'Get with serial' { $apiurl= "$url/api/v1/hardware/byserial/$asset_serial"}
|
||||||
|
'Assets due auditing soon' {$apiurl = "$url/api/v1/hardware/audit/due"}
|
||||||
|
'Assets overdue for auditing' {$apiurl = "$url/api/v1/hardware/audit/overdue"}
|
||||||
}
|
}
|
||||||
|
|
||||||
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 = $apiurl
|
Uri = $apiurl
|
||||||
|
|
@ -180,6 +188,7 @@ function Get-SnipeitAsset() {
|
||||||
if ($all) {
|
if ($all) {
|
||||||
$offstart = $(if ($offset){$offset} Else {0})
|
$offstart = $(if ($offset){$offset} Else {0})
|
||||||
$callargs = $SearchParameter
|
$callargs = $SearchParameter
|
||||||
|
Write-Verbose "Callargs: $($callargs | convertto-json)"
|
||||||
$callargs.Remove('all')
|
$callargs.Remove('all')
|
||||||
|
|
||||||
while ($true) {
|
while ($true) {
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ Get-SnipeitCategory -search "Laptop"
|
||||||
|
|
||||||
function Get-SnipeitCategory()
|
function Get-SnipeitCategory()
|
||||||
{
|
{
|
||||||
|
[CmdletBinding(DefaultParameterSetName = 'Search')]
|
||||||
Param(
|
Param(
|
||||||
[parameter(ParameterSetName='Search')]
|
[parameter(ParameterSetName='Search')]
|
||||||
[string]$search,
|
[string]$search,
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ Gets specific company
|
||||||
|
|
||||||
function Get-SnipeitCompany()
|
function Get-SnipeitCompany()
|
||||||
{
|
{
|
||||||
|
[CmdletBinding(DefaultParameterSetName = 'Search')]
|
||||||
Param(
|
Param(
|
||||||
[parameter(ParameterSetName='Search')]
|
[parameter(ParameterSetName='Search')]
|
||||||
[string]$search,
|
[string]$search,
|
||||||
|
|
|
||||||
|
|
@ -36,8 +36,8 @@ Get-SnipeitComponent -id
|
||||||
Returns specific component
|
Returns specific component
|
||||||
|
|
||||||
#>
|
#>
|
||||||
|
|
||||||
function Get-SnipeitComponent() {
|
function Get-SnipeitComponent() {
|
||||||
|
[CmdletBinding(DefaultParameterSetName = 'Search')]
|
||||||
Param(
|
Param(
|
||||||
[parameter(ParameterSetName='Search')]
|
[parameter(ParameterSetName='Search')]
|
||||||
[string]$search,
|
[string]$search,
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ Get-SnipeitDepartment -id 1
|
||||||
|
|
||||||
function Get-SnipeitDepartment()
|
function Get-SnipeitDepartment()
|
||||||
{
|
{
|
||||||
|
[CmdletBinding(DefaultParameterSetName = 'Search')]
|
||||||
Param(
|
Param(
|
||||||
[parameter(ParameterSetName='Search')]
|
[parameter(ParameterSetName='Search')]
|
||||||
[string]$search,
|
[string]$search,
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ Get-SnipeitLicense -id 1
|
||||||
#>
|
#>
|
||||||
|
|
||||||
function Get-SnipeitLicense() {
|
function Get-SnipeitLicense() {
|
||||||
|
[CmdletBinding(DefaultParameterSetName = 'Search')]
|
||||||
Param(
|
Param(
|
||||||
[parameter(ParameterSetName='Search')]
|
[parameter(ParameterSetName='Search')]
|
||||||
[string]$search,
|
[string]$search,
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ Get-SnipeitLocation -id 3
|
||||||
|
|
||||||
function Get-SnipeitLocation()
|
function Get-SnipeitLocation()
|
||||||
{
|
{
|
||||||
|
[CmdletBinding(DefaultParameterSetName = 'Search')]
|
||||||
Param(
|
Param(
|
||||||
[parameter(ParameterSetName='Search')]
|
[parameter(ParameterSetName='Search')]
|
||||||
[string]$search,
|
[string]$search,
|
||||||
|
|
|
||||||
|
|
@ -1,40 +1,40 @@
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
# Gets a list of Snipe-it Manufacturers
|
# Gets a list of Snipe-it Manufacturers
|
||||||
|
|
||||||
.PARAMETER search
|
.PARAMETER search
|
||||||
A text string to search the Manufactures data
|
A text string to search the Manufactures data
|
||||||
|
|
||||||
.PARAMETER id
|
.PARAMETER id
|
||||||
A id of specific Manufactuter
|
A id of specific Manufactuter
|
||||||
|
|
||||||
.PARAMETER limit
|
.PARAMETER limit
|
||||||
Specify the number of results you wish to return. Defaults to 50. Defines batch size for -all
|
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
|
.PARAMETER all
|
||||||
A return all results, works with -offset and other parameters
|
A return all results, works with -offset and other parameters
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Get-SnipeitManufacturer -search HP
|
Get-SnipeitManufacturer -search HP
|
||||||
Search all manufacturers for string HP
|
Search all manufacturers for string HP
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Get-SnipeitManufacturer -id 3
|
Get-SnipeitManufacturer -id 3
|
||||||
Returns manufacturer with id 3
|
Returns manufacturer with id 3
|
||||||
|
|
||||||
#>
|
#>
|
||||||
|
|
||||||
function Get-SnipeitManufacturer()
|
function Get-SnipeitManufacturer()
|
||||||
{
|
{
|
||||||
|
[CmdletBinding(DefaultParameterSetName = 'Search')]
|
||||||
Param(
|
Param(
|
||||||
[parameter(ParameterSetName='Search')]
|
[parameter(ParameterSetName='Search')]
|
||||||
[string]$search,
|
[string]$search,
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ Get-SnipeitModel -id 1
|
||||||
|
|
||||||
function Get-SnipeitModel()
|
function Get-SnipeitModel()
|
||||||
{
|
{
|
||||||
|
[CmdletBinding(DefaultParameterSetName = 'Search')]
|
||||||
Param(
|
Param(
|
||||||
[parameter(ParameterSetName='Search')]
|
[parameter(ParameterSetName='Search')]
|
||||||
[string]$search,
|
[string]$search,
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ Get-SnipeitStatus -id 3
|
||||||
|
|
||||||
function Get-SnipeitStatus()
|
function Get-SnipeitStatus()
|
||||||
{
|
{
|
||||||
|
[CmdletBinding(DefaultParameterSetName = 'Search')]
|
||||||
Param(
|
Param(
|
||||||
[parameter(ParameterSetName='Search')]
|
[parameter(ParameterSetName='Search')]
|
||||||
[string]$search,
|
[string]$search,
|
||||||
|
|
|
||||||
|
|
@ -30,9 +30,9 @@ Get-SnipeitSupplier -search MySupplier
|
||||||
Get-SnipeitSupplier -id 2
|
Get-SnipeitSupplier -id 2
|
||||||
|
|
||||||
#>
|
#>
|
||||||
|
|
||||||
function Get-SnipeitSupplier()
|
function Get-SnipeitSupplier()
|
||||||
{
|
{
|
||||||
|
[CmdletBinding(DefaultParameterSetName = 'Search')]
|
||||||
Param(
|
Param(
|
||||||
[parameter(ParameterSetName='Search')]
|
[parameter(ParameterSetName='Search')]
|
||||||
[string]$search,
|
[string]$search,
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,7 @@ Get-SnipeitUser -email user@somedomain.com
|
||||||
#>
|
#>
|
||||||
|
|
||||||
function Get-SnipeitUser() {
|
function Get-SnipeitUser() {
|
||||||
|
[CmdletBinding(DefaultParameterSetName = 'Search')]
|
||||||
Param(
|
Param(
|
||||||
[parameter(ParameterSetName='Search')]
|
[parameter(ParameterSetName='Search')]
|
||||||
[string]$search,
|
[string]$search,
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
.PARAMETER username
|
.PARAMETER username
|
||||||
Username for user
|
Username for user
|
||||||
|
|
||||||
.PARAMETER active
|
.PARAMETER activated
|
||||||
Can user log in to snipe-it?
|
Can user log in to snipe-it?
|
||||||
|
|
||||||
.PARAMETER notes
|
.PARAMETER notes
|
||||||
|
|
|
||||||
|
|
@ -10,12 +10,11 @@ Input string
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Get-Content [your-script.ps1] | Update-SnipeitAlias | Out-File [new-script-name.ps1]
|
Get-Content [your-script.ps1] | Update-SnipeitAlias | Out-File [new-script-name.ps1]
|
||||||
|
|
||||||
Replaces old command from file "your-script.ps1" and creates new script "new-script-name.ps1"
|
Replaces old command from file "your-script.ps1" and creates new script "new-script-name.ps1"
|
||||||
After testing new file you can replace old file with new.
|
After testing new file you can replace old file with new.
|
||||||
|
|
||||||
#>
|
#>
|
||||||
|
|
||||||
|
|
||||||
function Update-SnipeitAlias()
|
function Update-SnipeitAlias()
|
||||||
{
|
{
|
||||||
[CmdletBinding(
|
[CmdletBinding(
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ Gets a list of Snipe-it Accessories
|
||||||
|
|
||||||
## SYNTAX
|
## SYNTAX
|
||||||
|
|
||||||
### Search
|
### Search (Default)
|
||||||
```
|
```
|
||||||
Get-SnipeitAccessory [-search <String>] [-company_id <Int32>] [-category_id <Int32>] [-manufacturer_id <Int32>]
|
Get-SnipeitAccessory [-search <String>] [-company_id <Int32>] [-category_id <Int32>] [-manufacturer_id <Int32>]
|
||||||
[-supplier_id <Int32>] [-sort <String>] [-order <String>] [-limit <Int32>] [-offset <Int32>] [-all]
|
[-supplier_id <Int32>] [-sort <String>] [-order <String>] [-limit <Int32>] [-offset <Int32>] [-all]
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ Gets a list of Snipe-it Categories
|
||||||
|
|
||||||
## SYNTAX
|
## SYNTAX
|
||||||
|
|
||||||
### Search
|
### Search (Default)
|
||||||
```
|
```
|
||||||
Get-SnipeitCategory [-search <String>] [-order <String>] [-limit <Int32>] [-offset <Int32>] [-all]
|
Get-SnipeitCategory [-search <String>] [-order <String>] [-limit <Int32>] [-offset <Int32>] [-all]
|
||||||
-url <String> -apiKey <String> [<CommonParameters>]
|
-url <String> -apiKey <String> [<CommonParameters>]
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ Gets a list of Snipe-it Companies
|
||||||
|
|
||||||
## SYNTAX
|
## SYNTAX
|
||||||
|
|
||||||
### Search
|
### Search (Default)
|
||||||
```
|
```
|
||||||
Get-SnipeitCompany [-search <String>] [-order <String>] [-limit <Int32>] [-offset <Int32>] [-all] -url <String>
|
Get-SnipeitCompany [-search <String>] [-order <String>] [-limit <Int32>] [-offset <Int32>] [-all] -url <String>
|
||||||
-apiKey <String> [<CommonParameters>]
|
-apiKey <String> [<CommonParameters>]
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ Gets a list of Snipe-it Components
|
||||||
|
|
||||||
## SYNTAX
|
## SYNTAX
|
||||||
|
|
||||||
### Search
|
### Search (Default)
|
||||||
```
|
```
|
||||||
Get-SnipeitComponent [-search <String>] [-category_id <Int32>] [-company_id <Int32>] [-location_id <Int32>]
|
Get-SnipeitComponent [-search <String>] [-category_id <Int32>] [-company_id <Int32>] [-location_id <Int32>]
|
||||||
[-order <String>] [-sort <String>] [-limit <Int32>] [-offset <Int32>] [-all] -url <String> -apiKey <String>
|
[-order <String>] [-sort <String>] [-limit <Int32>] [-offset <Int32>] [-all] -url <String> -apiKey <String>
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ Gets a list of Snipe-it Departments
|
||||||
|
|
||||||
## SYNTAX
|
## SYNTAX
|
||||||
|
|
||||||
### Search
|
### Search (Default)
|
||||||
```
|
```
|
||||||
Get-SnipeitDepartment [-search <String>] [-order <String>] [-limit <Int32>] [-offset <Int32>] [-all]
|
Get-SnipeitDepartment [-search <String>] [-order <String>] [-limit <Int32>] [-offset <Int32>] [-all]
|
||||||
[-sort <String>] -url <String> -apiKey <String> [<CommonParameters>]
|
[-sort <String>] -url <String> -apiKey <String> [<CommonParameters>]
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ Gets a list of Snipe-it Licenses
|
||||||
|
|
||||||
## SYNTAX
|
## SYNTAX
|
||||||
|
|
||||||
### Search
|
### Search (Default)
|
||||||
```
|
```
|
||||||
Get-SnipeitLicense [-search <String>] [-name <String>] [-company_id <Int32>] [-product_key <String>]
|
Get-SnipeitLicense [-search <String>] [-name <String>] [-company_id <Int32>] [-product_key <String>]
|
||||||
[-order_number <String>] [-purchase_order <String>] [-license_name <String>] [-license_email <MailAddress>]
|
[-order_number <String>] [-purchase_order <String>] [-license_name <String>] [-license_email <MailAddress>]
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ Gets a list of Snipe-it Locations
|
||||||
|
|
||||||
## SYNTAX
|
## SYNTAX
|
||||||
|
|
||||||
### Search
|
### Search (Default)
|
||||||
```
|
```
|
||||||
Get-SnipeitLocation [-search <String>] [-order <String>] [-limit <Int32>] [-offset <Int32>] [-all]
|
Get-SnipeitLocation [-search <String>] [-order <String>] [-limit <Int32>] [-offset <Int32>] [-all]
|
||||||
-url <String> -apiKey <String> [<CommonParameters>]
|
-url <String> -apiKey <String> [<CommonParameters>]
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ schema: 2.0.0
|
||||||
|
|
||||||
## SYNTAX
|
## SYNTAX
|
||||||
|
|
||||||
### Search
|
### Search (Default)
|
||||||
```
|
```
|
||||||
Get-SnipeitManufacturer [-search <String>] [-order <String>] [-limit <Int32>] [-offset <Int32>] [-all]
|
Get-SnipeitManufacturer [-search <String>] [-order <String>] [-limit <Int32>] [-offset <Int32>] [-all]
|
||||||
-url <String> -apiKey <String> [<CommonParameters>]
|
-url <String> -apiKey <String> [<CommonParameters>]
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ Gets a list of Snipe-it Models
|
||||||
|
|
||||||
## SYNTAX
|
## SYNTAX
|
||||||
|
|
||||||
### Search
|
### Search (Default)
|
||||||
```
|
```
|
||||||
Get-SnipeitModel [-search <String>] [-order <String>] [-limit <Int32>] [-offset <Int32>] [-all] -url <String>
|
Get-SnipeitModel [-search <String>] [-order <String>] [-limit <Int32>] [-offset <Int32>] [-all] -url <String>
|
||||||
-apiKey <String> [<CommonParameters>]
|
-apiKey <String> [<CommonParameters>]
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ Gets a list of Snipe-it Status Labels
|
||||||
|
|
||||||
## SYNTAX
|
## SYNTAX
|
||||||
|
|
||||||
### Search
|
### Search (Default)
|
||||||
```
|
```
|
||||||
Get-SnipeitStatus [-search <String>] [-order <String>] [-limit <Int32>] [-offset <Int32>] [-all] -url <String>
|
Get-SnipeitStatus [-search <String>] [-order <String>] [-limit <Int32>] [-offset <Int32>] [-all] -url <String>
|
||||||
-apiKey <String> [<CommonParameters>]
|
-apiKey <String> [<CommonParameters>]
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ schema: 2.0.0
|
||||||
|
|
||||||
## SYNTAX
|
## SYNTAX
|
||||||
|
|
||||||
### Search
|
### Search (Default)
|
||||||
```
|
```
|
||||||
Get-SnipeitSupplier [-search <String>] [-order <String>] [-limit <Int32>] [-offset <Int32>] [-all]
|
Get-SnipeitSupplier [-search <String>] [-order <String>] [-limit <Int32>] [-offset <Int32>] [-all]
|
||||||
-url <String> -apiKey <String> [<CommonParameters>]
|
-url <String> -apiKey <String> [<CommonParameters>]
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ schema: 2.0.0
|
||||||
|
|
||||||
## SYNTAX
|
## SYNTAX
|
||||||
|
|
||||||
### Search
|
### Search (Default)
|
||||||
```
|
```
|
||||||
Get-SnipeitUser [-search <String>] [-company_id <Int32>] [-location_id <Int32>] [-group_id <Int32>]
|
Get-SnipeitUser [-search <String>] [-company_id <Int32>] [-location_id <Int32>] [-group_id <Int32>]
|
||||||
[-department_id <Int32>] [-username <String>] [-email <String>] [-order <String>] [-limit <Int32>]
|
[-department_id <Int32>] [-username <String>] [-email <String>] [-order <String>] [-limit <Int32>]
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ Set license seat or checkout license seat
|
||||||
## SYNTAX
|
## SYNTAX
|
||||||
|
|
||||||
```
|
```
|
||||||
Set-SnipeitLicenseSeat [-id] <Int32[]> [-seat_id] <Int32> [[-assigned_id] <Int32>] [[-asset_id] <Int32>]
|
Set-SnipeitLicenseSeat [-id] <Int32[]> [-seat_id] <Int32> [[-assigned_to] <Int32>] [[-asset_id] <Int32>]
|
||||||
[[-note] <String>] [-url] <String> [-apiKey] <String> [-WhatIf] [-Confirm] [<CommonParameters>]
|
[[-note] <String>] [-url] <String> [-apiKey] <String> [-WhatIf] [-Confirm] [<CommonParameters>]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -66,13 +66,13 @@ Accept pipeline input: False
|
||||||
Accept wildcard characters: False
|
Accept wildcard characters: False
|
||||||
```
|
```
|
||||||
|
|
||||||
### -assigned_id
|
### -assigned_to
|
||||||
{{ Fill assigned_id Description }}
|
Id of target user
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
Type: Int32
|
Type: Int32
|
||||||
Parameter Sets: (All)
|
Parameter Sets: (All)
|
||||||
Aliases:
|
Aliases: assigned_id
|
||||||
|
|
||||||
Required: False
|
Required: False
|
||||||
Position: 3
|
Position: 3
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ Updates user with id 3
|
||||||
## PARAMETERS
|
## PARAMETERS
|
||||||
|
|
||||||
### -activated
|
### -activated
|
||||||
{{ Fill activated Description }}
|
Can user log in to snipe-it?
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
Type: Boolean
|
Type: Boolean
|
||||||
|
|
|
||||||
|
|
@ -135,5 +135,5 @@ Updates Model on Snipe-it asset system
|
||||||
Creates a new user
|
Creates a new user
|
||||||
|
|
||||||
### [Update-SnipeitAlias](Update-SnipeitAlias.md)
|
### [Update-SnipeitAlias](Update-SnipeitAlias.md)
|
||||||
{{ Fill in the Synopsis }}
|
Replaces old SnipeitPS commands with new ones
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ schema: 2.0.0
|
||||||
# Update-SnipeitAlias
|
# Update-SnipeitAlias
|
||||||
|
|
||||||
## SYNOPSIS
|
## SYNOPSIS
|
||||||
{{ Fill in the Synopsis }}
|
Replaces old SnipeitPS commands with new ones
|
||||||
|
|
||||||
## SYNTAX
|
## SYNTAX
|
||||||
|
|
||||||
|
|
@ -17,21 +17,22 @@ Update-SnipeitAlias [-String] <String[]> [-WhatIf] [-Confirm] [<CommonParameters
|
||||||
```
|
```
|
||||||
|
|
||||||
## DESCRIPTION
|
## DESCRIPTION
|
||||||
{{ Fill in the Description }}
|
Replaces old SnipeitPS commands with new ones
|
||||||
|
|
||||||
## EXAMPLES
|
## EXAMPLES
|
||||||
|
|
||||||
### Example 1
|
### EXAMPLE 1
|
||||||
```powershell
|
```
|
||||||
PS C:\> {{ Add example code here }}
|
Get-Content [your-script.ps1] | Update-SnipeitAlias | Out-File [new-script-name.ps1]
|
||||||
```
|
```
|
||||||
|
|
||||||
{{ Add example description here }}
|
Replaces old command from file "your-script.ps1" and creates new script "new-script-name.ps1"
|
||||||
|
After testing new file you can replace old file with new.
|
||||||
|
|
||||||
## PARAMETERS
|
## PARAMETERS
|
||||||
|
|
||||||
### -String
|
### -String
|
||||||
{{ Fill String Description }}
|
Input string
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
Type: String[]
|
Type: String[]
|
||||||
|
|
@ -39,7 +40,7 @@ Parameter Sets: (All)
|
||||||
Aliases:
|
Aliases:
|
||||||
|
|
||||||
Required: True
|
Required: True
|
||||||
Position: 0
|
Position: 1
|
||||||
Default value: None
|
Default value: None
|
||||||
Accept pipeline input: True (ByValue)
|
Accept pipeline input: True (ByValue)
|
||||||
Accept wildcard characters: False
|
Accept wildcard characters: False
|
||||||
|
|
@ -81,11 +82,8 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
|
||||||
|
|
||||||
## INPUTS
|
## INPUTS
|
||||||
|
|
||||||
### System.String[]
|
|
||||||
|
|
||||||
## OUTPUTS
|
## OUTPUTS
|
||||||
|
|
||||||
### System.Object
|
|
||||||
## NOTES
|
## NOTES
|
||||||
|
|
||||||
## RELATED LINKS
|
## RELATED LINKS
|
||||||
|
|
|
||||||
43
docs/about_SnipeitPS.md
Normal file
43
docs/about_SnipeitPS.md
Normal file
|
|
@ -0,0 +1,43 @@
|
||||||
|
# About SnipeitPS
|
||||||
|
## about_SnipeitPS
|
||||||
|
|
||||||
|
# SHORT DESCRIPTION
|
||||||
|
Powershell API Wrapper for Snipe-it.
|
||||||
|
|
||||||
|
# LONG DESCRIPTION
|
||||||
|
Collection of tools that makes interacting with Snipe-it api more pleasant.
|
||||||
|
|
||||||
|
# EXAMPLES
|
||||||
|
Prepare connection Snipe-It with:
|
||||||
|
|
||||||
|
Set-SnipeitInfo -url https://your.site -apikey YourVeryLongApiKey....
|
||||||
|
|
||||||
|
To search assets use:
|
||||||
|
|
||||||
|
Get-SnipeitAsset -search needle
|
||||||
|
|
||||||
|
Piping get and new commands results to set commands is supported. Followirg will
|
||||||
|
set notes for every asset that have model_id 123.
|
||||||
|
|
||||||
|
Get-SnipeitAsset -model_id 123 -all | Set-SnipeitAsset
|
||||||
|
|
||||||
|
You can get specific items with -id prameter like
|
||||||
|
|
||||||
|
Get-SnipeitModel -id 123
|
||||||
|
|
||||||
|
# NOTE
|
||||||
|
Most of commands are using same parameters as in Snipe It api,
|
||||||
|
but it's always good idea check syntax with Get-Help
|
||||||
|
|
||||||
|
# TROUBLESHOOTING NOTE
|
||||||
|
Check your api key and certificate on server first.
|
||||||
|
|
||||||
|
# SEE ALSO
|
||||||
|
|
||||||
|
Report any issues to:
|
||||||
|
[GitHub project page](https://github.com/snazy2000/SnipeitPS/issues)
|
||||||
|
|
||||||
|
# KEYWORDS
|
||||||
|
|
||||||
|
- Snipe-It
|
||||||
|
- asset management
|
||||||
Loading…
Add table
Reference in a new issue