mirror of
https://github.com/snazy2000/SnipeitPS.git
synced 2025-12-14 02:12:29 +00:00
Merge pull request #1 from snazy2000/develop
Merge Changes in to Master
This commit is contained in:
commit
f5218583c8
43 changed files with 1336 additions and 966 deletions
22
.vscode/launch.json
vendored
22
.vscode/launch.json
vendored
|
|
@ -1,13 +1,6 @@
|
||||||
{
|
{
|
||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"configurations": [
|
"configurations": [{
|
||||||
{
|
|
||||||
"type": "PowerShell",
|
|
||||||
"request": "launch",
|
|
||||||
"name": "PowerShell Interactive Session",
|
|
||||||
"cwd": "${workspaceRoot}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "PowerShell",
|
"type": "PowerShell",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"name": "PowerShell Pester Tests",
|
"name": "PowerShell Pester Tests",
|
||||||
|
|
@ -22,6 +15,19 @@
|
||||||
"script": "${file}",
|
"script": "${file}",
|
||||||
"args": [],
|
"args": [],
|
||||||
"cwd": "${file}"
|
"cwd": "${file}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "PowerShell",
|
||||||
|
"request": "attach",
|
||||||
|
"name": "PowerShell Attach to Host Process",
|
||||||
|
"processId": "${command.PickPSHostProcess}",
|
||||||
|
"runspaceId": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "PowerShell",
|
||||||
|
"request": "launch",
|
||||||
|
"name": "PowerShell Interactive Session",
|
||||||
|
"cwd": "${workspaceRoot}"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
15
.vscode/settings.json
vendored
Normal file
15
.vscode/settings.json
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
// Place your settings in this file to overwrite default and user settings.
|
||||||
|
{
|
||||||
|
"files.encoding": "utf8",
|
||||||
|
"files.eol": "\r\n",
|
||||||
|
"files.trimTrailingWhitespace": true,
|
||||||
|
"files.insertFinalNewline": true,
|
||||||
|
"editor.tabSize": 4,
|
||||||
|
"[markdown]": {
|
||||||
|
"editor.wordwrap": "on",
|
||||||
|
"editor.renderWhitespace": "all",
|
||||||
|
"editor.acceptSuggestionOnEnter": false,
|
||||||
|
"editor.rulers": [80],
|
||||||
|
"editor.trimAutoWhitespace": false
|
||||||
|
}
|
||||||
|
}
|
||||||
56
.vscode/tasks.json
vendored
Normal file
56
.vscode/tasks.json
vendored
Normal file
|
|
@ -0,0 +1,56 @@
|
||||||
|
// Available variables which can be used inside of strings.
|
||||||
|
// ${workspaceRoot}: the root folder of the team
|
||||||
|
// ${file}: the current opened file
|
||||||
|
// ${relativeFile}: the current opened file relative to workspaceRoot
|
||||||
|
// ${fileBasename}: the current opened file's basename
|
||||||
|
// ${fileDirname}: the current opened file's dirname
|
||||||
|
// ${fileExtname}: the current opened file's extension
|
||||||
|
// ${cwd}: the current working directory of the spawned process
|
||||||
|
{
|
||||||
|
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||||
|
// for the documentation about the tasks.json format
|
||||||
|
"version": "2.0.0",
|
||||||
|
// Start PowerShell
|
||||||
|
"windows": {
|
||||||
|
"command": "${env:windir}\\sysnative\\windowspowershell\\v1.0\\PowerShell.exe",
|
||||||
|
"args": [
|
||||||
|
"-NoProfile",
|
||||||
|
"-ExecutionPolicy",
|
||||||
|
"Bypass"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"linux": {
|
||||||
|
"command": "/usr/bin/powershell",
|
||||||
|
"args": [
|
||||||
|
"-NoProfile"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"osx": {
|
||||||
|
"command": "/usr/local/bin/powershell",
|
||||||
|
"args": [
|
||||||
|
"-NoProfile"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
// Show the output window always
|
||||||
|
"showOutput": "always",
|
||||||
|
// Associate with test task runner
|
||||||
|
"tasks": [{
|
||||||
|
"taskName": "Build Help",
|
||||||
|
"suppressTaskName": true,
|
||||||
|
"args": [
|
||||||
|
"Write-Host 'Invoking platyPS'; New-ExternalHelp -Path .\\docs\\en-US -OutputPath .\\ConfluencePS\\en-US -Force;",
|
||||||
|
"Invoke-Command { Write-Host 'Completed Build task in task runner.' }"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"taskName": "Test",
|
||||||
|
"suppressTaskName": true,
|
||||||
|
"isTestCommand": true,
|
||||||
|
"args": [
|
||||||
|
"Write-Host 'Invoking Pester'; Invoke-Pester -PesterOption @{IncludeVSCodeMarker=$true};",
|
||||||
|
"Invoke-Command { Write-Host 'Completed Test task in task runner.' }"
|
||||||
|
],
|
||||||
|
"problemMatcher": "$pester"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -1 +1,8 @@
|
||||||
[1.0]
|
# Change Log
|
||||||
|
|
||||||
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
|
The format is based on [Keep a Changelog](http://keepachangelog.com/),
|
||||||
|
and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||||
|
|
||||||
|
## [1.0] - 2017-11-18
|
||||||
|
|
|
||||||
31
README.md
31
README.md
|
|
@ -1 +1,30 @@
|
||||||
[](https://ci.appveyor.com/project/snazy2000/snipeitps)
|
[](https://github.com/snazy2000/snipeitps/releases/latest) [](https://ci.appveyor.com/project/snazy2000/snipeitps/branch/master) [](https://www.powershellgallery.com/packages/snipeitps) 
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Instructions
|
||||||
|
|
||||||
|
### Installation
|
||||||
|
|
||||||
|
Install SnipeitPS from the PowerShell Gallery `Install-Module` requires PowerShellGet (included in PS v5, or download for v3/v4 via the gallery link)
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
# One time only install: (requires an admin PowerShell window)
|
||||||
|
Install-Module SnipeitPS
|
||||||
|
|
||||||
|
# Check for updates occasionally:
|
||||||
|
Update-Module SnipeitPS
|
||||||
|
|
||||||
|
# To use each session:
|
||||||
|
Import-Module SnipeitPS
|
||||||
|
Set-Info -URL 'https://asset.example.com' -apiKey 'tokenKey'
|
||||||
|
```
|
||||||
|
|
||||||
|
### Usage
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
# Review the help at any time!
|
||||||
|
Get-Help about_SnipeitPS
|
||||||
|
Get-Command -Module SnipeitPS
|
||||||
|
Get-Help Get-Asset -Full # or any other command
|
||||||
|
```
|
||||||
|
|
|
||||||
|
|
@ -217,6 +217,7 @@ task PushRelease GitStatus, GetVersion, {
|
||||||
}
|
}
|
||||||
# endregion
|
# endregion
|
||||||
|
|
||||||
|
|
||||||
#region Cleaning tasks
|
#region Cleaning tasks
|
||||||
task Clean RemoveGeneratedFiles
|
task Clean RemoveGeneratedFiles
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
function Invoke-Method {
|
function Invoke-SnipeitMethod {
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Extracted invokation of the REST method to own function.
|
Extracted invokation of the REST method to own function.
|
||||||
|
|
@ -1,177 +0,0 @@
|
||||||
<#
|
|
||||||
.SYNOPSIS
|
|
||||||
# Gets a list of Snipe-it Assets
|
|
||||||
|
|
||||||
.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-Asset -url "https://assets.dip.co.uk" -token "token..."
|
|
||||||
|
|
||||||
.EXAMPLE
|
|
||||||
Get-Asset -url "https://assets.dip.co.uk" -token "token..." | Where-Object {$_.name -eq "SUPPORT23" }
|
|
||||||
|
|
||||||
#>
|
|
||||||
|
|
||||||
function Get-Asset()
|
|
||||||
{
|
|
||||||
Param(
|
|
||||||
[parameter(mandatory=$true)]
|
|
||||||
[string]$url,
|
|
||||||
|
|
||||||
[parameter(mandatory=$true)]
|
|
||||||
[string]$apiKey
|
|
||||||
)
|
|
||||||
|
|
||||||
$result = Invoke-Method -URi "$url/api/v1/hardware" `
|
|
||||||
-Method GET `
|
|
||||||
-Token $apiKey
|
|
||||||
|
|
||||||
$result
|
|
||||||
}
|
|
||||||
|
|
||||||
function New-Asset()
|
|
||||||
{
|
|
||||||
[CmdletBinding(
|
|
||||||
SupportsShouldProcess=$true,
|
|
||||||
ConfirmImpact="High"
|
|
||||||
)]
|
|
||||||
|
|
||||||
Param(
|
|
||||||
[parameter(mandatory=$true)]
|
|
||||||
[string]$Name,
|
|
||||||
|
|
||||||
[parameter(mandatory=$true)]
|
|
||||||
[string]$Status_id,
|
|
||||||
|
|
||||||
[parameter(mandatory=$true)]
|
|
||||||
[string]$Model_id,
|
|
||||||
|
|
||||||
[parameter(mandatory=$true)]
|
|
||||||
[string]$url,
|
|
||||||
|
|
||||||
[parameter(mandatory=$true)]
|
|
||||||
[string]$apiKey,
|
|
||||||
|
|
||||||
[hashtable] $customfields
|
|
||||||
)
|
|
||||||
|
|
||||||
$Values = @{
|
|
||||||
"name" = $Name
|
|
||||||
"status_id" = $status_id
|
|
||||||
"model_id" = $model_id
|
|
||||||
}
|
|
||||||
|
|
||||||
$Values += $customfields
|
|
||||||
|
|
||||||
$Body = $Values | ConvertTo-Json;
|
|
||||||
|
|
||||||
$Parameters = @{
|
|
||||||
Uri = "$url/api/v1/hardware"
|
|
||||||
Method = 'Post'
|
|
||||||
Body = $Body
|
|
||||||
Token = $apiKey
|
|
||||||
}
|
|
||||||
|
|
||||||
If ($PSCmdlet.ShouldProcess()) {
|
|
||||||
$result = Invoke-Method @Parameters
|
|
||||||
}
|
|
||||||
|
|
||||||
$result
|
|
||||||
}
|
|
||||||
|
|
||||||
function Set-Asset()
|
|
||||||
{
|
|
||||||
[CmdletBinding(
|
|
||||||
SupportsShouldProcess=$true,
|
|
||||||
ConfirmImpact="High"
|
|
||||||
)]
|
|
||||||
|
|
||||||
Param(
|
|
||||||
[parameter(mandatory=$true)]
|
|
||||||
[int]$id,
|
|
||||||
|
|
||||||
[parameter(mandatory=$true)]
|
|
||||||
[string]$Name,
|
|
||||||
|
|
||||||
[parameter(mandatory=$true)]
|
|
||||||
[string]$Status_id,
|
|
||||||
|
|
||||||
[parameter(mandatory=$true)]
|
|
||||||
[string]$Model_id,
|
|
||||||
|
|
||||||
[parameter(mandatory=$true)]
|
|
||||||
[string]$url,
|
|
||||||
|
|
||||||
[parameter(mandatory=$true)]
|
|
||||||
[string]$apiKey,
|
|
||||||
|
|
||||||
[hashtable] $customfields
|
|
||||||
)
|
|
||||||
|
|
||||||
$Values = @{
|
|
||||||
"name" = $Name
|
|
||||||
"status_id" = $status_id
|
|
||||||
"model_id" = $model_id
|
|
||||||
}
|
|
||||||
|
|
||||||
$Values += $customfields
|
|
||||||
$Body = $Values | ConvertTo-Json;
|
|
||||||
|
|
||||||
$Parameters = @{
|
|
||||||
Uri = "$url/api/v1/hardware/$id"
|
|
||||||
Method = 'Put'
|
|
||||||
Body = $Body
|
|
||||||
Token = $apiKey
|
|
||||||
}
|
|
||||||
|
|
||||||
If ($PSCmdlet.ShouldProcess()) {
|
|
||||||
$result = Invoke-Method @Parameters
|
|
||||||
}
|
|
||||||
|
|
||||||
$result
|
|
||||||
}
|
|
||||||
|
|
||||||
function Set-AssetOwner()
|
|
||||||
{
|
|
||||||
[CmdletBinding(
|
|
||||||
SupportsShouldProcess=$true,
|
|
||||||
ConfirmImpact="High"
|
|
||||||
)]
|
|
||||||
|
|
||||||
Param(
|
|
||||||
[parameter(mandatory=$true)]
|
|
||||||
[int]$id,
|
|
||||||
|
|
||||||
[parameter(mandatory=$true)]
|
|
||||||
[int]$user_id,
|
|
||||||
|
|
||||||
[parameter(mandatory=$true)]
|
|
||||||
[string]$url,
|
|
||||||
|
|
||||||
[parameter(mandatory=$true)]
|
|
||||||
[string]$apiKey
|
|
||||||
)
|
|
||||||
|
|
||||||
$Values = @{
|
|
||||||
"user_id" = $user_id
|
|
||||||
}
|
|
||||||
|
|
||||||
$Body = $Values | ConvertTo-Json;
|
|
||||||
|
|
||||||
$Parameters = @{
|
|
||||||
Uri = "$url/api/v1/hardware/$id/checkout"
|
|
||||||
Method = 'POST'
|
|
||||||
Body = $Body
|
|
||||||
Token = $apiKey
|
|
||||||
}
|
|
||||||
|
|
||||||
If ($PSCmdlet.ShouldProcess()) {
|
|
||||||
$result = Invoke-Method @Parameters
|
|
||||||
}
|
|
||||||
|
|
||||||
return $result
|
|
||||||
}
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
function Get-Category()
|
|
||||||
{
|
|
||||||
Param(
|
|
||||||
[parameter(mandatory=$true)]
|
|
||||||
[string]$url,
|
|
||||||
|
|
||||||
[parameter(mandatory=$true)]
|
|
||||||
[string]$apiKey
|
|
||||||
)
|
|
||||||
|
|
||||||
$result = Invoke-Method -URi "$url/api/v1/categories" `
|
|
||||||
-Method GET `
|
|
||||||
-Token $apiKey
|
|
||||||
|
|
||||||
$result
|
|
||||||
}
|
|
||||||
|
|
@ -1,124 +0,0 @@
|
||||||
function Get-Component()
|
|
||||||
{
|
|
||||||
Param(
|
|
||||||
[parameter(mandatory=$true)]
|
|
||||||
[string]$url,
|
|
||||||
|
|
||||||
[parameter(mandatory=$true)]
|
|
||||||
[string]$apiKey
|
|
||||||
)
|
|
||||||
|
|
||||||
$result = Invoke-Method -URi "$url/api/v1/components" `
|
|
||||||
-Method GET `
|
|
||||||
-Token $apiKey
|
|
||||||
|
|
||||||
$result
|
|
||||||
}
|
|
||||||
|
|
||||||
function New-Component()
|
|
||||||
{
|
|
||||||
[CmdletBinding(
|
|
||||||
SupportsShouldProcess=$true,
|
|
||||||
ConfirmImpact="High"
|
|
||||||
)]
|
|
||||||
|
|
||||||
Param(
|
|
||||||
[parameter(mandatory=$true)]
|
|
||||||
[string]$name,
|
|
||||||
|
|
||||||
[parameter(mandatory=$true)]
|
|
||||||
[string]$category_id,
|
|
||||||
|
|
||||||
[parameter(mandatory=$true)]
|
|
||||||
[string]$qty,
|
|
||||||
|
|
||||||
[parameter(mandatory=$true)]
|
|
||||||
[string]$url,
|
|
||||||
|
|
||||||
[parameter(mandatory=$true)]
|
|
||||||
[string]$apiKey
|
|
||||||
)
|
|
||||||
|
|
||||||
$Values = @{
|
|
||||||
"name" = $name
|
|
||||||
"category_id" = $category_id
|
|
||||||
"qty" = $qty
|
|
||||||
}
|
|
||||||
|
|
||||||
$Body = $Values | ConvertTo-Json;
|
|
||||||
|
|
||||||
$Parameters = @{
|
|
||||||
Uri = "$url/api/v1/components"
|
|
||||||
Method = 'POST'
|
|
||||||
Body = $Body
|
|
||||||
Token = $apiKey
|
|
||||||
}
|
|
||||||
|
|
||||||
If ($PSCmdlet.ShouldProcess()) {
|
|
||||||
$result = Invoke-Method @Parameters
|
|
||||||
}
|
|
||||||
|
|
||||||
$result
|
|
||||||
}
|
|
||||||
|
|
||||||
function Set-Component()
|
|
||||||
{
|
|
||||||
[CmdletBinding(
|
|
||||||
SupportsShouldProcess=$true,
|
|
||||||
ConfirmImpact="High"
|
|
||||||
)]
|
|
||||||
|
|
||||||
Param(
|
|
||||||
[parameter(mandatory=$true)]
|
|
||||||
[string]$id,
|
|
||||||
|
|
||||||
[parameter(mandatory=$true)]
|
|
||||||
[string]$qty,
|
|
||||||
|
|
||||||
[parameter(mandatory=$true)]
|
|
||||||
[string]$url,
|
|
||||||
|
|
||||||
[parameter(mandatory=$true)]
|
|
||||||
[string]$apiKey
|
|
||||||
)
|
|
||||||
|
|
||||||
$Values = @{
|
|
||||||
"qty" = $qty
|
|
||||||
}
|
|
||||||
|
|
||||||
$Body = $Values | ConvertTo-Json;
|
|
||||||
|
|
||||||
$Parameters = @{
|
|
||||||
Uri = "$url/api/v1/components/$component_id"
|
|
||||||
Method = 'Patch'
|
|
||||||
Body = $Body
|
|
||||||
Token = $apiKey
|
|
||||||
}
|
|
||||||
|
|
||||||
If ($PSCmdlet.ShouldProcess()) {
|
|
||||||
$result = Invoke-Method @Parameters
|
|
||||||
}
|
|
||||||
|
|
||||||
$result
|
|
||||||
}
|
|
||||||
|
|
||||||
<#
|
|
||||||
Checkout does not exsit yet :(
|
|
||||||
|
|
||||||
function Checkout-Component($component_id, $asset_id = "")
|
|
||||||
{
|
|
||||||
$Values = @{
|
|
||||||
"asset_id" = $asset_id
|
|
||||||
}
|
|
||||||
|
|
||||||
$Body = $Values | ConvertTo-Json;
|
|
||||||
|
|
||||||
$Manufacturers = Invoke-RestMethod -Uri "http://assets.dip.co.uk/api/v1/hardware/$component_id/checkout" `
|
|
||||||
-Method Post `
|
|
||||||
-Header $headers `
|
|
||||||
-Body $Body `
|
|
||||||
-ContentType "application/json" `
|
|
||||||
-UserAgent "DI Script/0.1"
|
|
||||||
|
|
||||||
return $Manufacturers
|
|
||||||
}#>
|
|
||||||
44
SnipeitPS/Public/Get-Asset.ps1
Normal file
44
SnipeitPS/Public/Get-Asset.ps1
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
# Gets a list of Snipe-it Assets
|
||||||
|
|
||||||
|
.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-Asset -url "https://assets.example.com" -token "token..."
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
Get-Asset -url "https://assets.example.com" -token "token..." | Where-Object {$_.name -eq "MyMachine" }
|
||||||
|
|
||||||
|
#>
|
||||||
|
|
||||||
|
function Get-Asset()
|
||||||
|
{
|
||||||
|
Param(
|
||||||
|
[parameter(mandatory=$true)]
|
||||||
|
[string]$url,
|
||||||
|
|
||||||
|
[parameter(mandatory=$true)]
|
||||||
|
[string]$apiKey
|
||||||
|
)
|
||||||
|
|
||||||
|
$Parameters = @{
|
||||||
|
Uri = "$url/api/v1/hardware"
|
||||||
|
Method = 'Get'
|
||||||
|
Token = $apiKey
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
|
|
||||||
|
$result
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
38
SnipeitPS/Public/Get-Category.ps1
Normal file
38
SnipeitPS/Public/Get-Category.ps1
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
# Gets a list of Snipe-it Categories
|
||||||
|
|
||||||
|
.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-Category -url "https://assets.example.com" -token "token..."
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
Get-Category -url "https://assets.example.com" -token "token..." | Where-Object {$_.name -eq "Laptop" }
|
||||||
|
|
||||||
|
#>
|
||||||
|
|
||||||
|
function Get-Category()
|
||||||
|
{
|
||||||
|
Param(
|
||||||
|
[parameter(mandatory=$true)]
|
||||||
|
[string]$url,
|
||||||
|
|
||||||
|
[parameter(mandatory=$true)]
|
||||||
|
[string]$apiKey
|
||||||
|
)
|
||||||
|
|
||||||
|
$Parameters = @{
|
||||||
|
Uri = "$url/api/v1/categories"
|
||||||
|
Method = 'Get'
|
||||||
|
Token = $apiKey
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
|
|
||||||
|
$result
|
||||||
|
}
|
||||||
38
SnipeitPS/Public/Get-Component.ps1
Normal file
38
SnipeitPS/Public/Get-Component.ps1
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
# Gets a list of Snipe-it Components
|
||||||
|
|
||||||
|
.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-Component -url "https://assets.example.com" -token "token..."
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
Get-Component -url "https://assets.example.com" -token "token..." | Where-Object {$_.name -eq "Memory" }
|
||||||
|
|
||||||
|
#>
|
||||||
|
|
||||||
|
function Get-Component()
|
||||||
|
{
|
||||||
|
Param(
|
||||||
|
[parameter(mandatory=$true)]
|
||||||
|
[string]$url,
|
||||||
|
|
||||||
|
[parameter(mandatory=$true)]
|
||||||
|
[string]$apiKey
|
||||||
|
)
|
||||||
|
|
||||||
|
$Parameters = @{
|
||||||
|
Uri = "$url/api/v1/components"
|
||||||
|
Method = 'Get'
|
||||||
|
Token = $apiKey
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
|
|
||||||
|
$result
|
||||||
|
}
|
||||||
38
SnipeitPS/Public/Get-Manufacturer.ps1
Normal file
38
SnipeitPS/Public/Get-Manufacturer.ps1
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
# Gets a list of Snipe-it Manufacturers
|
||||||
|
|
||||||
|
.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-Manufacturer -url "https://assets.example.com" -token "token..."
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
Get-Manufacturer -url "https://assets.example.com" -token "token..." | Where-Object {$_.name -eq "HP" }
|
||||||
|
|
||||||
|
#>
|
||||||
|
|
||||||
|
function Get-Manufacturer()
|
||||||
|
{
|
||||||
|
Param(
|
||||||
|
[parameter(mandatory=$true)]
|
||||||
|
[string]$url,
|
||||||
|
|
||||||
|
[parameter(mandatory=$true)]
|
||||||
|
[string]$apiKey
|
||||||
|
)
|
||||||
|
|
||||||
|
$Parameters = @{
|
||||||
|
Uri = "$url/api/v1/manufacturers"
|
||||||
|
Method = 'Get'
|
||||||
|
Token = $apiKey
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
|
|
||||||
|
$result
|
||||||
|
}
|
||||||
38
SnipeitPS/Public/Get-Model.ps1
Normal file
38
SnipeitPS/Public/Get-Model.ps1
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
# Gets a list of Snipe-it Models
|
||||||
|
|
||||||
|
.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-Models -url "https://assets.example.com" -token "token..."
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
Get-Models -url "https://assets.example.com" -token "token..." | Where-Object {$_.name -eq "DL380" }
|
||||||
|
|
||||||
|
#>
|
||||||
|
|
||||||
|
function Get-Model()
|
||||||
|
{
|
||||||
|
Param(
|
||||||
|
[parameter(mandatory = $true)]
|
||||||
|
[string]$url,
|
||||||
|
|
||||||
|
[parameter(mandatory = $true)]
|
||||||
|
[string]$apiKey
|
||||||
|
)
|
||||||
|
|
||||||
|
$Parameters = @{
|
||||||
|
Uri = "$url/api/v1/models"
|
||||||
|
Method = 'Get'
|
||||||
|
Token = $apiKey
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
|
|
||||||
|
$result
|
||||||
|
}
|
||||||
38
SnipeitPS/Public/Get-Status.ps1
Normal file
38
SnipeitPS/Public/Get-Status.ps1
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
# Gets a list of Snipe-it Status Labels
|
||||||
|
|
||||||
|
.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-Status -url "https://assets.example.com" -token "token..."
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
Get-Status -url "https://assets.example.com" -token "token..." | Where-Object {$_.name -eq "Ready to Deploy" }
|
||||||
|
|
||||||
|
#>
|
||||||
|
|
||||||
|
function Get-Status()
|
||||||
|
{
|
||||||
|
Param(
|
||||||
|
[parameter(mandatory=$true)]
|
||||||
|
[string]$url,
|
||||||
|
|
||||||
|
[parameter(mandatory=$true)]
|
||||||
|
[string]$apiKey
|
||||||
|
)
|
||||||
|
|
||||||
|
$Parameters = @{
|
||||||
|
Uri = "$url/api/v1/statuslabels"
|
||||||
|
Method = 'Get'
|
||||||
|
Token = $apiKey
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
|
|
||||||
|
$result
|
||||||
|
}
|
||||||
40
SnipeitPS/Public/Get-User.ps1
Normal file
40
SnipeitPS/Public/Get-User.ps1
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
# Gets a list of Snipe-it Users
|
||||||
|
|
||||||
|
.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-User -url "https://assets.example.com" -token "token..."
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
Get-User -url "https://assets.example.com" -token "token..." | Where-Object {$_.username -eq "stephenm" }
|
||||||
|
|
||||||
|
#>
|
||||||
|
function Get-User()
|
||||||
|
{
|
||||||
|
Param(
|
||||||
|
[parameter(mandatory=$true)]
|
||||||
|
[string]$url,
|
||||||
|
|
||||||
|
[parameter(mandatory=$true)]
|
||||||
|
[string]$apiKey
|
||||||
|
)
|
||||||
|
|
||||||
|
$Parameters = @{
|
||||||
|
Uri = "$url/api/v1/users"
|
||||||
|
Method = 'Get'
|
||||||
|
GetParameters = @{
|
||||||
|
limit = 999
|
||||||
|
}
|
||||||
|
Token = $apiKey
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
|
|
||||||
|
$result
|
||||||
|
}
|
||||||
|
|
@ -1,56 +0,0 @@
|
||||||
function Get-Manufacturer()
|
|
||||||
{
|
|
||||||
Param(
|
|
||||||
[parameter(mandatory=$true)]
|
|
||||||
[string]$url,
|
|
||||||
|
|
||||||
[parameter(mandatory=$true)]
|
|
||||||
[string]$apiKey
|
|
||||||
)
|
|
||||||
|
|
||||||
$result = Invoke-Method -URi "$url/api/v1/manufacturers" `
|
|
||||||
-Method GET `
|
|
||||||
-Token $apiKey
|
|
||||||
|
|
||||||
$result
|
|
||||||
}
|
|
||||||
|
|
||||||
function New-Manufacturer()
|
|
||||||
{
|
|
||||||
[CmdletBinding(
|
|
||||||
SupportsShouldProcess=$true,
|
|
||||||
ConfirmImpact="High"
|
|
||||||
)]
|
|
||||||
|
|
||||||
Param(
|
|
||||||
[parameter(mandatory=$true)]
|
|
||||||
[string]$Name,
|
|
||||||
|
|
||||||
[parameter(mandatory=$true)]
|
|
||||||
[string]$url,
|
|
||||||
|
|
||||||
[parameter(mandatory=$true)]
|
|
||||||
[string]$apiKey
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
$Values = @{
|
|
||||||
"name" = $Name
|
|
||||||
}
|
|
||||||
|
|
||||||
#Convert Values to JSON format
|
|
||||||
$Body = $Values | ConvertTo-Json;
|
|
||||||
|
|
||||||
$Parameters = @{
|
|
||||||
Uri = "$url/api/v1/manufacturers"
|
|
||||||
Method = 'post'
|
|
||||||
Body = $Body
|
|
||||||
Token = $apiKey
|
|
||||||
}
|
|
||||||
|
|
||||||
If ($PSCmdlet.ShouldProcess()) {
|
|
||||||
$result = Invoke-Method @Parameters
|
|
||||||
}
|
|
||||||
|
|
||||||
$result
|
|
||||||
}
|
|
||||||
|
|
@ -1,68 +0,0 @@
|
||||||
|
|
||||||
function Get-Model()
|
|
||||||
{
|
|
||||||
Param(
|
|
||||||
[parameter(mandatory=$true)]
|
|
||||||
[string]$url,
|
|
||||||
|
|
||||||
[parameter(mandatory=$true)]
|
|
||||||
[string]$apiKey
|
|
||||||
)
|
|
||||||
|
|
||||||
$result = Invoke-Method -URi "$url/api/v1/models" `
|
|
||||||
-Method GET `
|
|
||||||
-Token $apiKey
|
|
||||||
|
|
||||||
$result
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function New-Model()
|
|
||||||
{
|
|
||||||
[CmdletBinding(
|
|
||||||
SupportsShouldProcess=$true,
|
|
||||||
ConfirmImpact="High"
|
|
||||||
)]
|
|
||||||
|
|
||||||
Param(
|
|
||||||
[parameter(mandatory=$true)]
|
|
||||||
[string]$name,
|
|
||||||
|
|
||||||
[parameter(mandatory=$true)]
|
|
||||||
[int]$category_id,
|
|
||||||
|
|
||||||
[parameter(mandatory=$true)]
|
|
||||||
[int]$manufacturer_id,
|
|
||||||
|
|
||||||
[parameter(mandatory=$true)]
|
|
||||||
[int]$fieldset_id,
|
|
||||||
|
|
||||||
[parameter(mandatory=$true)]
|
|
||||||
[string]$url,
|
|
||||||
|
|
||||||
[parameter(mandatory=$true)]
|
|
||||||
[string]$apiKey
|
|
||||||
)
|
|
||||||
|
|
||||||
$Values = @{
|
|
||||||
name = $name
|
|
||||||
category_id = $category_id
|
|
||||||
manufacturer_id = $manufacturer_id
|
|
||||||
fieldset_id = $fieldset_id
|
|
||||||
}
|
|
||||||
|
|
||||||
$Body = $Values | ConvertTo-Json;
|
|
||||||
|
|
||||||
$Parameters = @{
|
|
||||||
Uri = "$url/api/v1/models"
|
|
||||||
Method = 'post'
|
|
||||||
Body = $Body
|
|
||||||
Token = $apiKey
|
|
||||||
}
|
|
||||||
|
|
||||||
If ($PSCmdlet.ShouldProcess()) {
|
|
||||||
$result = Invoke-Method @Parameters
|
|
||||||
}
|
|
||||||
|
|
||||||
$result
|
|
||||||
}
|
|
||||||
91
SnipeitPS/Public/New-Asset.ps1
Normal file
91
SnipeitPS/Public/New-Asset.ps1
Normal file
|
|
@ -0,0 +1,91 @@
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Add a new Asset to Snipe-it asset system
|
||||||
|
|
||||||
|
.DESCRIPTION
|
||||||
|
Long description
|
||||||
|
|
||||||
|
.PARAMETER Tag
|
||||||
|
Asset Tag for the Asset
|
||||||
|
|
||||||
|
.PARAMETER Name
|
||||||
|
Name of the Asset
|
||||||
|
|
||||||
|
.PARAMETER Status_id
|
||||||
|
Status ID of the asset, this can be got using Get-Status
|
||||||
|
|
||||||
|
.PARAMETER Model_id
|
||||||
|
Model ID of the asset, this can be got using Get-Model
|
||||||
|
|
||||||
|
.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
|
||||||
|
|
||||||
|
.PARAMETER customfields
|
||||||
|
Hastable of custom fields and extra fields that need passing through to Snipeit
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
New-Asset -status_id 1 -model_id 1 -name "Machine1"
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
New-Asset -status_id 1 -model_id 1 -name "Machine1" -CustomValues = @{ "_snipeit_os_5 = "Windows 10 Pro" }
|
||||||
|
#>
|
||||||
|
|
||||||
|
function New-Asset()
|
||||||
|
{
|
||||||
|
[CmdletBinding(
|
||||||
|
SupportsShouldProcess = $true,
|
||||||
|
ConfirmImpact = "High"
|
||||||
|
)]
|
||||||
|
|
||||||
|
Param(
|
||||||
|
[string]$tag,
|
||||||
|
|
||||||
|
[parameter(mandatory = $true)]
|
||||||
|
[string]$Name,
|
||||||
|
|
||||||
|
[parameter(mandatory = $true)]
|
||||||
|
[string]$Status_id,
|
||||||
|
|
||||||
|
[parameter(mandatory = $true)]
|
||||||
|
[string]$Model_id,
|
||||||
|
|
||||||
|
[parameter(mandatory = $true)]
|
||||||
|
[string]$url,
|
||||||
|
|
||||||
|
[parameter(mandatory = $true)]
|
||||||
|
[string]$apiKey,
|
||||||
|
|
||||||
|
[hashtable] $customfields
|
||||||
|
)
|
||||||
|
|
||||||
|
$Values = @{
|
||||||
|
"asset_tag" = $tag
|
||||||
|
"name" = $Name
|
||||||
|
"status_id" = $status_id
|
||||||
|
"model_id" = $model_id
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($customfields)
|
||||||
|
{
|
||||||
|
$Values += $customfields
|
||||||
|
}
|
||||||
|
|
||||||
|
$Body = $Values | ConvertTo-Json;
|
||||||
|
|
||||||
|
$Parameters = @{
|
||||||
|
Uri = "$url/api/v1/hardware"
|
||||||
|
Method = 'Post'
|
||||||
|
Body = $Body
|
||||||
|
Token = $apiKey
|
||||||
|
}
|
||||||
|
|
||||||
|
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
|
||||||
|
{
|
||||||
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
|
}
|
||||||
|
|
||||||
|
$result
|
||||||
|
}
|
||||||
76
SnipeitPS/Public/New-Component.ps1
Normal file
76
SnipeitPS/Public/New-Component.ps1
Normal file
|
|
@ -0,0 +1,76 @@
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Short description
|
||||||
|
|
||||||
|
.DESCRIPTION
|
||||||
|
Long description
|
||||||
|
|
||||||
|
.PARAMETER name
|
||||||
|
Parameter description
|
||||||
|
|
||||||
|
.PARAMETER category_id
|
||||||
|
Parameter description
|
||||||
|
|
||||||
|
.PARAMETER qty
|
||||||
|
Parameter description
|
||||||
|
|
||||||
|
.PARAMETER url
|
||||||
|
Parameter description
|
||||||
|
|
||||||
|
.PARAMETER apiKey
|
||||||
|
Parameter description
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
An example
|
||||||
|
|
||||||
|
.NOTES
|
||||||
|
General notes
|
||||||
|
#>
|
||||||
|
|
||||||
|
function New-Component()
|
||||||
|
{
|
||||||
|
[CmdletBinding(
|
||||||
|
SupportsShouldProcess = $true,
|
||||||
|
ConfirmImpact = "High"
|
||||||
|
)]
|
||||||
|
|
||||||
|
Param(
|
||||||
|
[parameter(mandatory = $true)]
|
||||||
|
[string]$name,
|
||||||
|
|
||||||
|
[parameter(mandatory = $true)]
|
||||||
|
[string]$category_id,
|
||||||
|
|
||||||
|
[parameter(mandatory = $true)]
|
||||||
|
[string]$qty,
|
||||||
|
|
||||||
|
[parameter(mandatory = $true)]
|
||||||
|
[string]$url,
|
||||||
|
|
||||||
|
[parameter(mandatory = $true)]
|
||||||
|
[string]$apiKey
|
||||||
|
)
|
||||||
|
|
||||||
|
$Values = @{
|
||||||
|
"name" = $name
|
||||||
|
"category_id" = $category_id
|
||||||
|
"qty" = $qty
|
||||||
|
}
|
||||||
|
|
||||||
|
$Body = $Values | ConvertTo-Json;
|
||||||
|
|
||||||
|
$Parameters = @{
|
||||||
|
Uri = "$url/api/v1/components"
|
||||||
|
Method = 'POST'
|
||||||
|
Body = $Body
|
||||||
|
Token = $apiKey
|
||||||
|
}
|
||||||
|
|
||||||
|
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
|
||||||
|
{
|
||||||
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
|
}
|
||||||
|
|
||||||
|
$result
|
||||||
|
}
|
||||||
|
|
||||||
60
SnipeitPS/Public/New-Manufacturer.ps1
Normal file
60
SnipeitPS/Public/New-Manufacturer.ps1
Normal file
|
|
@ -0,0 +1,60 @@
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Add a new Manufacturer to Snipe-it asset system
|
||||||
|
|
||||||
|
.DESCRIPTION
|
||||||
|
Long description
|
||||||
|
|
||||||
|
.PARAMETER Name
|
||||||
|
Name of the Manufacturer
|
||||||
|
|
||||||
|
.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
|
||||||
|
New-Manufacturer -name "HP"
|
||||||
|
#>
|
||||||
|
|
||||||
|
function New-Manufacturer()
|
||||||
|
{
|
||||||
|
[CmdletBinding(
|
||||||
|
SupportsShouldProcess = $true,
|
||||||
|
ConfirmImpact = "High"
|
||||||
|
)]
|
||||||
|
|
||||||
|
Param(
|
||||||
|
[parameter(mandatory = $true)]
|
||||||
|
[string]$Name,
|
||||||
|
|
||||||
|
[parameter(mandatory = $true)]
|
||||||
|
[string]$url,
|
||||||
|
|
||||||
|
[parameter(mandatory = $true)]
|
||||||
|
[string]$apiKey
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
$Values = @{
|
||||||
|
"name" = $Name
|
||||||
|
}
|
||||||
|
|
||||||
|
#Convert Values to JSON format
|
||||||
|
$Body = $Values | ConvertTo-Json;
|
||||||
|
|
||||||
|
$Parameters = @{
|
||||||
|
Uri = "$url/api/v1/manufacturers"
|
||||||
|
Method = 'post'
|
||||||
|
Body = $Body
|
||||||
|
Token = $apiKey
|
||||||
|
}
|
||||||
|
|
||||||
|
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
|
||||||
|
{
|
||||||
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
|
}
|
||||||
|
|
||||||
|
$result
|
||||||
|
}
|
||||||
79
SnipeitPS/Public/New-Model.ps1
Normal file
79
SnipeitPS/Public/New-Model.ps1
Normal file
|
|
@ -0,0 +1,79 @@
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Add a new Model to Snipe-it asset system
|
||||||
|
|
||||||
|
.DESCRIPTION
|
||||||
|
Long description
|
||||||
|
|
||||||
|
.PARAMETER name
|
||||||
|
Name of the Asset Model
|
||||||
|
|
||||||
|
.PARAMETER category_id
|
||||||
|
Category ID that the asset belongs to this can be got using Get-Category
|
||||||
|
|
||||||
|
.PARAMETER manufacturer_id
|
||||||
|
Manufacturer ID that the asset belongs to this can be got using Get-Manufacturer
|
||||||
|
|
||||||
|
.PARAMETER fieldset_id
|
||||||
|
Fieldset ID that the asset uses (Custom fields)
|
||||||
|
|
||||||
|
.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
|
||||||
|
New-Model -name "DL380" -manufacturer_id 2 -fieldset_id 2 -category_id 1
|
||||||
|
#>
|
||||||
|
|
||||||
|
function New-Model()
|
||||||
|
{
|
||||||
|
[CmdletBinding(
|
||||||
|
SupportsShouldProcess = $true,
|
||||||
|
ConfirmImpact = "High"
|
||||||
|
)]
|
||||||
|
|
||||||
|
Param(
|
||||||
|
[parameter(mandatory = $true)]
|
||||||
|
[string]$name,
|
||||||
|
|
||||||
|
[parameter(mandatory = $true)]
|
||||||
|
[int]$category_id,
|
||||||
|
|
||||||
|
[parameter(mandatory = $true)]
|
||||||
|
[int]$manufacturer_id,
|
||||||
|
|
||||||
|
[parameter(mandatory = $true)]
|
||||||
|
[int]$fieldset_id,
|
||||||
|
|
||||||
|
[parameter(mandatory = $true)]
|
||||||
|
[string]$url,
|
||||||
|
|
||||||
|
[parameter(mandatory = $true)]
|
||||||
|
[string]$apiKey
|
||||||
|
)
|
||||||
|
|
||||||
|
$Values = @{
|
||||||
|
name = $name
|
||||||
|
category_id = $category_id
|
||||||
|
manufacturer_id = $manufacturer_id
|
||||||
|
fieldset_id = $fieldset_id
|
||||||
|
}
|
||||||
|
|
||||||
|
$Body = $Values | ConvertTo-Json;
|
||||||
|
|
||||||
|
$Parameters = @{
|
||||||
|
Uri = "$url/api/v1/models"
|
||||||
|
Method = 'post'
|
||||||
|
Body = $Body
|
||||||
|
Token = $apiKey
|
||||||
|
}
|
||||||
|
|
||||||
|
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
|
||||||
|
{
|
||||||
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
|
}
|
||||||
|
|
||||||
|
$result
|
||||||
|
}
|
||||||
91
SnipeitPS/Public/Set-Asset.ps1
Normal file
91
SnipeitPS/Public/Set-Asset.ps1
Normal file
|
|
@ -0,0 +1,91 @@
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Update a Asset in the Snipe-it asset system
|
||||||
|
|
||||||
|
.DESCRIPTION
|
||||||
|
Long description
|
||||||
|
|
||||||
|
.PARAMETER id
|
||||||
|
ID of the Asset
|
||||||
|
|
||||||
|
.PARAMETER Name
|
||||||
|
Name of the Asset
|
||||||
|
|
||||||
|
.PARAMETER Status_id
|
||||||
|
Status ID of the asset, this can be got using Get-Status
|
||||||
|
|
||||||
|
.PARAMETER Model_id
|
||||||
|
Model ID of the asset, this can be got using Get-Model
|
||||||
|
|
||||||
|
.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
|
||||||
|
|
||||||
|
.PARAMETER customfields
|
||||||
|
Hastable of custom fields and extra fields that need passing through to Snipeit
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
Set-Asset -id 1 -status_id 1 -model_id 1 -name "Machine1"
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
Set-Asset -id 1 -status_id 1 -model_id 1 -name "Machine1" -CustomValues = @{ "_snipeit_os_5 = "Windows 10 Pro" }
|
||||||
|
#>
|
||||||
|
|
||||||
|
function Set-Asset()
|
||||||
|
{
|
||||||
|
[CmdletBinding(
|
||||||
|
SupportsShouldProcess = $true,
|
||||||
|
ConfirmImpact = "High"
|
||||||
|
)]
|
||||||
|
|
||||||
|
Param(
|
||||||
|
[parameter(mandatory = $true)]
|
||||||
|
[int]$id,
|
||||||
|
|
||||||
|
[parameter(mandatory = $true)]
|
||||||
|
[string]$Name,
|
||||||
|
|
||||||
|
[parameter(mandatory = $true)]
|
||||||
|
[string]$Status_id,
|
||||||
|
|
||||||
|
[parameter(mandatory = $true)]
|
||||||
|
[string]$Model_id,
|
||||||
|
|
||||||
|
[parameter(mandatory = $true)]
|
||||||
|
[string]$url,
|
||||||
|
|
||||||
|
[parameter(mandatory = $true)]
|
||||||
|
[string]$apiKey,
|
||||||
|
|
||||||
|
[hashtable] $customfields
|
||||||
|
)
|
||||||
|
|
||||||
|
$Values = @{
|
||||||
|
"name" = $Name
|
||||||
|
"status_id" = $status_id
|
||||||
|
"model_id" = $model_id
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($customfields)
|
||||||
|
{
|
||||||
|
$Values += $customfields
|
||||||
|
}
|
||||||
|
|
||||||
|
$Body = $Values | ConvertTo-Json;
|
||||||
|
|
||||||
|
$Parameters = @{
|
||||||
|
Uri = "$url/api/v1/hardware/$id"
|
||||||
|
Method = 'Put'
|
||||||
|
Body = $Body
|
||||||
|
Token = $apiKey
|
||||||
|
}
|
||||||
|
|
||||||
|
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
|
||||||
|
{
|
||||||
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
|
}
|
||||||
|
|
||||||
|
$result
|
||||||
|
}
|
||||||
41
SnipeitPS/Public/Set-AssetOwner.ps1
Normal file
41
SnipeitPS/Public/Set-AssetOwner.ps1
Normal file
|
|
@ -0,0 +1,41 @@
|
||||||
|
function Set-AssetOwner()
|
||||||
|
{
|
||||||
|
[CmdletBinding(
|
||||||
|
SupportsShouldProcess = $true,
|
||||||
|
ConfirmImpact = "High"
|
||||||
|
)]
|
||||||
|
|
||||||
|
Param(
|
||||||
|
[parameter(mandatory = $true)]
|
||||||
|
[int]$id,
|
||||||
|
|
||||||
|
[parameter(mandatory = $true)]
|
||||||
|
[int]$user_id,
|
||||||
|
|
||||||
|
[parameter(mandatory = $true)]
|
||||||
|
[string]$url,
|
||||||
|
|
||||||
|
[parameter(mandatory = $true)]
|
||||||
|
[string]$apiKey
|
||||||
|
)
|
||||||
|
|
||||||
|
$Values = @{
|
||||||
|
"user_id" = $user_id
|
||||||
|
}
|
||||||
|
|
||||||
|
$Body = $Values | ConvertTo-Json;
|
||||||
|
|
||||||
|
$Parameters = @{
|
||||||
|
Uri = "$url/api/v1/hardware/$id/checkout"
|
||||||
|
Method = 'POST'
|
||||||
|
Body = $Body
|
||||||
|
Token = $apiKey
|
||||||
|
}
|
||||||
|
|
||||||
|
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
|
||||||
|
{
|
||||||
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result
|
||||||
|
}
|
||||||
41
SnipeitPS/Public/Set-Components.ps1
Normal file
41
SnipeitPS/Public/Set-Components.ps1
Normal file
|
|
@ -0,0 +1,41 @@
|
||||||
|
function Set-Component()
|
||||||
|
{
|
||||||
|
[CmdletBinding(
|
||||||
|
SupportsShouldProcess = $true,
|
||||||
|
ConfirmImpact = "High"
|
||||||
|
)]
|
||||||
|
|
||||||
|
Param(
|
||||||
|
[parameter(mandatory = $true)]
|
||||||
|
[string]$id,
|
||||||
|
|
||||||
|
[parameter(mandatory = $true)]
|
||||||
|
[string]$qty,
|
||||||
|
|
||||||
|
[parameter(mandatory = $true)]
|
||||||
|
[string]$url,
|
||||||
|
|
||||||
|
[parameter(mandatory = $true)]
|
||||||
|
[string]$apiKey
|
||||||
|
)
|
||||||
|
|
||||||
|
$Values = @{
|
||||||
|
"qty" = $qty
|
||||||
|
}
|
||||||
|
|
||||||
|
$Body = $Values | ConvertTo-Json;
|
||||||
|
|
||||||
|
$Parameters = @{
|
||||||
|
Uri = "$url/api/v1/components/$component_id"
|
||||||
|
Method = 'Patch'
|
||||||
|
Body = $Body
|
||||||
|
Token = $apiKey
|
||||||
|
}
|
||||||
|
|
||||||
|
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
|
||||||
|
{
|
||||||
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
|
}
|
||||||
|
|
||||||
|
$result
|
||||||
|
}
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
function Get-Status()
|
|
||||||
{
|
|
||||||
Param(
|
|
||||||
[parameter(mandatory=$true)]
|
|
||||||
[string]$url,
|
|
||||||
|
|
||||||
[parameter(mandatory=$true)]
|
|
||||||
[string]$apiKey
|
|
||||||
)
|
|
||||||
|
|
||||||
$result = Invoke-Method -URi "$url/api/v1/statuslabels" `
|
|
||||||
-Method GET `
|
|
||||||
-Token $apiKey
|
|
||||||
|
|
||||||
$result
|
|
||||||
}
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
||||||
<#
|
|
||||||
.SYNOPSIS
|
|
||||||
# Gets a list of Snipe-it Users
|
|
||||||
|
|
||||||
.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-Users -url "https://assets.dip.co.uk" -token "token..."
|
|
||||||
|
|
||||||
.EXAMPLE
|
|
||||||
Get-Users -url "https://assets.dip.co.uk" -token "token..." | Where-Object {$_.username -eq "stephenm" }
|
|
||||||
|
|
||||||
#>
|
|
||||||
function Get-User()
|
|
||||||
{
|
|
||||||
Param(
|
|
||||||
[parameter(mandatory=$true)]
|
|
||||||
[string]$url,
|
|
||||||
|
|
||||||
[parameter(mandatory=$true)]
|
|
||||||
[string]$apiKey
|
|
||||||
)
|
|
||||||
|
|
||||||
$result = Invoke-Method -URi "$url/api/v1/users?limit=999" `
|
|
||||||
-Method GET `
|
|
||||||
-Token $apiKey
|
|
||||||
|
|
||||||
$result
|
|
||||||
}
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
$scriptRoot = $PSScriptRoot + '\public'
|
$scriptRoot = $PSScriptRoot + '\public'
|
||||||
|
|
||||||
Get-ChildItem $scriptRoot *.psm1 | ForEach-Object {
|
Get-ChildItem $scriptRoot *.ps1 | ForEach-Object {
|
||||||
Import-Module $_.FullName
|
Import-Module $_.FullName
|
||||||
}
|
}
|
||||||
|
|
||||||
$scriptRoot = $PSScriptRoot + '\private'
|
$scriptRoot = $PSScriptRoot + '\private'
|
||||||
|
|
||||||
Get-ChildItem $scriptRoot *.psm1 | ForEach-Object {
|
Get-ChildItem $scriptRoot *.ps1 | ForEach-Object {
|
||||||
Import-Module $_.FullName
|
Import-Module $_.FullName
|
||||||
}
|
}
|
||||||
|
|
@ -8,7 +8,6 @@ $manifestFile = "$moduleRoot\SnipeitPS.psd1"
|
||||||
$changelogFile = "$projectRoot\CHANGELOG.md"
|
$changelogFile = "$projectRoot\CHANGELOG.md"
|
||||||
$appveyorFile = "$projectRoot\appveyor.yml"
|
$appveyorFile = "$projectRoot\appveyor.yml"
|
||||||
$publicFunctions = "$moduleRoot\Public"
|
$publicFunctions = "$moduleRoot\Public"
|
||||||
$internalFunctions = "$moduleRoot\Private"
|
|
||||||
|
|
||||||
Describe "SnipeitPS" {
|
Describe "SnipeitPS" {
|
||||||
Context "All required tests are present" {
|
Context "All required tests are present" {
|
||||||
|
|
@ -31,18 +30,22 @@ Describe "SnipeitPS" {
|
||||||
|
|
||||||
$script:manifest = $null
|
$script:manifest = $null
|
||||||
|
|
||||||
foreach ($line in (Get-Content $changelogFile)) {
|
foreach ($line in (Get-Content $changelogFile))
|
||||||
if ($line -match "^\D*(?<Version>(\d+\.){1,3}\d+)") {
|
{
|
||||||
|
if ($line -match "^\D*(?<Version>(\d+\.){1,3}\d+)")
|
||||||
|
{
|
||||||
$changelogVersion = $matches.Version
|
$changelogVersion = $matches.Version
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($line in (Get-Content $appveyorFile)) {
|
foreach ($line in (Get-Content $appveyorFile))
|
||||||
|
{
|
||||||
# (?<Version>()) - non-capturing group, but named Version. This makes it
|
# (?<Version>()) - non-capturing group, but named Version. This makes it
|
||||||
# easy to reference the inside group later.
|
# easy to reference the inside group later.
|
||||||
|
|
||||||
if ($line -match '^\D*(?<Version>(\d+\.){1,3}\d+).\{build\}') {
|
if ($line -match '^\D*(?<Version>(\d+\.){1,3}\d+).\{build\}')
|
||||||
|
{
|
||||||
$appveyorVersion = $matches.Version
|
$appveyorVersion = $matches.Version
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
@ -149,34 +152,41 @@ Describe "SnipeitPS" {
|
||||||
|
|
||||||
It 'Source files contain no trailing whitespace' {
|
It 'Source files contain no trailing whitespace' {
|
||||||
$badLines = @(
|
$badLines = @(
|
||||||
foreach ($file in $files) {
|
foreach ($file in $files)
|
||||||
|
{
|
||||||
$lines = [System.IO.File]::ReadAllLines($file.FullName)
|
$lines = [System.IO.File]::ReadAllLines($file.FullName)
|
||||||
$lineCount = $lines.Count
|
$lineCount = $lines.Count
|
||||||
|
|
||||||
for ($i = 0; $i -lt $lineCount; $i++) {
|
for ($i = 0; $i -lt $lineCount; $i++)
|
||||||
if ($lines[$i] -match '\s+$') {
|
{
|
||||||
|
if ($lines[$i] -match '\s+$')
|
||||||
|
{
|
||||||
'File: {0}, Line: {1}' -f $file.FullName, ($i + 1)
|
'File: {0}, Line: {1}' -f $file.FullName, ($i + 1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
if ($badLines.Count -gt 0) {
|
if ($badLines.Count -gt 0)
|
||||||
|
{
|
||||||
throw "The following $($badLines.Count) lines contain trailing whitespace: `r`n`r`n$($badLines -join "`r`n")"
|
throw "The following $($badLines.Count) lines contain trailing whitespace: `r`n`r`n$($badLines -join "`r`n")"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
It 'Source files all end with a newline' {
|
It 'Source files all end with a newline' {
|
||||||
$badFiles = @(
|
$badFiles = @(
|
||||||
foreach ($file in $files) {
|
foreach ($file in $files)
|
||||||
|
{
|
||||||
$string = [System.IO.File]::ReadAllText($file.FullName)
|
$string = [System.IO.File]::ReadAllText($file.FullName)
|
||||||
if ($string.Length -gt 0 -and $string[-1] -ne "`n") {
|
if ($string.Length -gt 0 -and $string[-1] -ne "`n")
|
||||||
|
{
|
||||||
$file.FullName
|
$file.FullName
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
if ($badFiles.Count -gt 0) {
|
if ($badFiles.Count -gt 0)
|
||||||
|
{
|
||||||
throw "The following files do not end with a newline: `r`n`r`n$($badFiles -join "`r`n")"
|
throw "The following files do not end with a newline: `r`n`r`n$($badFiles -join "`r`n")"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -186,11 +196,13 @@ Describe "SnipeitPS" {
|
||||||
$analysis = Invoke-ScriptAnalyzer -Path "$moduleRoot" -Recurse
|
$analysis = Invoke-ScriptAnalyzer -Path "$moduleRoot" -Recurse
|
||||||
$scriptAnalyzerRules = Get-ScriptAnalyzerRule
|
$scriptAnalyzerRules = Get-ScriptAnalyzerRule
|
||||||
|
|
||||||
forEach ($rule in $scriptAnalyzerRules) {
|
forEach ($rule in $scriptAnalyzerRules)
|
||||||
|
{
|
||||||
It "Should pass $rule" {
|
It "Should pass $rule" {
|
||||||
If (($analysis) -and ($analysis.RuleName -contains $rule)) {
|
If (($analysis) -and ($analysis.RuleName -contains $rule))
|
||||||
|
{
|
||||||
$analysis |
|
$analysis |
|
||||||
Where RuleName -EQ $rule -OutVariable failures |
|
Where-Object RuleName -EQ $rule -OutVariable failures |
|
||||||
Out-Default
|
Out-Default
|
||||||
$failures.Count | Should Be 0
|
$failures.Count | Should Be 0
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,12 +23,12 @@ Get-Asset [-url] <String> [-apiKey] <String>
|
||||||
|
|
||||||
### -------------------------- EXAMPLE 1 --------------------------
|
### -------------------------- EXAMPLE 1 --------------------------
|
||||||
```
|
```
|
||||||
Get-Asset -url "https://assets.dip.co.uk" -token "token..."
|
Get-Asset -url "https://assets.example.com" -token "token..."
|
||||||
```
|
```
|
||||||
|
|
||||||
### -------------------------- EXAMPLE 2 --------------------------
|
### -------------------------- EXAMPLE 2 --------------------------
|
||||||
```
|
```
|
||||||
Get-Asset -url "https://assets.dip.co.uk" -token "token..." | Where-Object {$_.name -eq "SUPPORT23" }
|
Get-Asset -url "https://assets.example.com" -token "token..." | Where-Object {$_.name -eq "MyMachine" }
|
||||||
```
|
```
|
||||||
|
|
||||||
## PARAMETERS
|
## PARAMETERS
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ schema: 2.0.0
|
||||||
# Get-Category
|
# Get-Category
|
||||||
|
|
||||||
## SYNOPSIS
|
## SYNOPSIS
|
||||||
{{Fill in the Synopsis}}
|
# Gets a list of Snipe-it Categories
|
||||||
|
|
||||||
## SYNTAX
|
## SYNTAX
|
||||||
|
|
||||||
|
|
@ -21,17 +21,20 @@ Get-Category [-url] <String> [-apiKey] <String>
|
||||||
|
|
||||||
## EXAMPLES
|
## EXAMPLES
|
||||||
|
|
||||||
### Example 1
|
### -------------------------- EXAMPLE 1 --------------------------
|
||||||
```
|
```
|
||||||
PS C:\> {{ Add example code here }}
|
Get-Category -url "https://assets.example.com" -token "token..."
|
||||||
```
|
```
|
||||||
|
|
||||||
{{ Add example description here }}
|
### -------------------------- EXAMPLE 2 --------------------------
|
||||||
|
```
|
||||||
|
Get-Category -url "https://assets.example.com" -token "token..." | Where-Object {$_.name -eq "Laptop" }
|
||||||
|
```
|
||||||
|
|
||||||
## PARAMETERS
|
## PARAMETERS
|
||||||
|
|
||||||
### -apiKey
|
### -url
|
||||||
{{Fill apiKey Description}}
|
URL of Snipeit system, can be set using Set-Info command
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
Type: String
|
Type: String
|
||||||
|
|
@ -45,8 +48,8 @@ Accept pipeline input: False
|
||||||
Accept wildcard characters: False
|
Accept wildcard characters: False
|
||||||
```
|
```
|
||||||
|
|
||||||
### -url
|
### -apiKey
|
||||||
{{Fill url Description}}
|
Users API Key for Snipeit, can be set using Set-Info command
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
Type: String
|
Type: String
|
||||||
|
|
@ -54,7 +57,7 @@ Parameter Sets: (All)
|
||||||
Aliases:
|
Aliases:
|
||||||
|
|
||||||
Required: True
|
Required: True
|
||||||
Position: 0
|
Position: 2
|
||||||
Default value: None
|
Default value: None
|
||||||
Accept pipeline input: False
|
Accept pipeline input: False
|
||||||
Accept wildcard characters: False
|
Accept wildcard characters: False
|
||||||
|
|
@ -62,13 +65,8 @@ Accept wildcard characters: False
|
||||||
|
|
||||||
## INPUTS
|
## INPUTS
|
||||||
|
|
||||||
### None
|
|
||||||
|
|
||||||
|
|
||||||
## OUTPUTS
|
## OUTPUTS
|
||||||
|
|
||||||
### System.Object
|
|
||||||
|
|
||||||
## NOTES
|
## NOTES
|
||||||
|
|
||||||
## RELATED LINKS
|
## RELATED LINKS
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ schema: 2.0.0
|
||||||
# Get-Component
|
# Get-Component
|
||||||
|
|
||||||
## SYNOPSIS
|
## SYNOPSIS
|
||||||
{{Fill in the Synopsis}}
|
# Gets a list of Snipe-it Components
|
||||||
|
|
||||||
## SYNTAX
|
## SYNTAX
|
||||||
|
|
||||||
|
|
@ -21,17 +21,20 @@ Get-Component [-url] <String> [-apiKey] <String>
|
||||||
|
|
||||||
## EXAMPLES
|
## EXAMPLES
|
||||||
|
|
||||||
### Example 1
|
### -------------------------- EXAMPLE 1 --------------------------
|
||||||
```
|
```
|
||||||
PS C:\> {{ Add example code here }}
|
Get-Component -url "https://assets.example.com" -token "token..."
|
||||||
```
|
```
|
||||||
|
|
||||||
{{ Add example description here }}
|
### -------------------------- EXAMPLE 2 --------------------------
|
||||||
|
```
|
||||||
|
Get-Component -url "https://assets.example.com" -token "token..." | Where-Object {$_.name -eq "Memory" }
|
||||||
|
```
|
||||||
|
|
||||||
## PARAMETERS
|
## PARAMETERS
|
||||||
|
|
||||||
### -apiKey
|
### -url
|
||||||
{{Fill apiKey Description}}
|
URL of Snipeit system, can be set using Set-Info command
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
Type: String
|
Type: String
|
||||||
|
|
@ -45,8 +48,8 @@ Accept pipeline input: False
|
||||||
Accept wildcard characters: False
|
Accept wildcard characters: False
|
||||||
```
|
```
|
||||||
|
|
||||||
### -url
|
### -apiKey
|
||||||
{{Fill url Description}}
|
Users API Key for Snipeit, can be set using Set-Info command
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
Type: String
|
Type: String
|
||||||
|
|
@ -54,7 +57,7 @@ Parameter Sets: (All)
|
||||||
Aliases:
|
Aliases:
|
||||||
|
|
||||||
Required: True
|
Required: True
|
||||||
Position: 0
|
Position: 2
|
||||||
Default value: None
|
Default value: None
|
||||||
Accept pipeline input: False
|
Accept pipeline input: False
|
||||||
Accept wildcard characters: False
|
Accept wildcard characters: False
|
||||||
|
|
@ -62,13 +65,8 @@ Accept wildcard characters: False
|
||||||
|
|
||||||
## INPUTS
|
## INPUTS
|
||||||
|
|
||||||
### None
|
|
||||||
|
|
||||||
|
|
||||||
## OUTPUTS
|
## OUTPUTS
|
||||||
|
|
||||||
### System.Object
|
|
||||||
|
|
||||||
## NOTES
|
## NOTES
|
||||||
|
|
||||||
## RELATED LINKS
|
## RELATED LINKS
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ schema: 2.0.0
|
||||||
# Get-Manufacturer
|
# Get-Manufacturer
|
||||||
|
|
||||||
## SYNOPSIS
|
## SYNOPSIS
|
||||||
{{Fill in the Synopsis}}
|
# Gets a list of Snipe-it Manufacturers
|
||||||
|
|
||||||
## SYNTAX
|
## SYNTAX
|
||||||
|
|
||||||
|
|
@ -21,17 +21,20 @@ Get-Manufacturer [-url] <String> [-apiKey] <String>
|
||||||
|
|
||||||
## EXAMPLES
|
## EXAMPLES
|
||||||
|
|
||||||
### Example 1
|
### -------------------------- EXAMPLE 1 --------------------------
|
||||||
```
|
```
|
||||||
PS C:\> {{ Add example code here }}
|
Get-Manufacturer -url "https://assets.example.com" -token "token..."
|
||||||
```
|
```
|
||||||
|
|
||||||
{{ Add example description here }}
|
### -------------------------- EXAMPLE 2 --------------------------
|
||||||
|
```
|
||||||
|
Get-Manufacturer -url "https://assets.example.com" -token "token..." | Where-Object {$_.name -eq "HP" }
|
||||||
|
```
|
||||||
|
|
||||||
## PARAMETERS
|
## PARAMETERS
|
||||||
|
|
||||||
### -apiKey
|
### -url
|
||||||
{{Fill apiKey Description}}
|
URL of Snipeit system, can be set using Set-Info command
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
Type: String
|
Type: String
|
||||||
|
|
@ -45,8 +48,8 @@ Accept pipeline input: False
|
||||||
Accept wildcard characters: False
|
Accept wildcard characters: False
|
||||||
```
|
```
|
||||||
|
|
||||||
### -url
|
### -apiKey
|
||||||
{{Fill url Description}}
|
Users API Key for Snipeit, can be set using Set-Info command
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
Type: String
|
Type: String
|
||||||
|
|
@ -54,7 +57,7 @@ Parameter Sets: (All)
|
||||||
Aliases:
|
Aliases:
|
||||||
|
|
||||||
Required: True
|
Required: True
|
||||||
Position: 0
|
Position: 2
|
||||||
Default value: None
|
Default value: None
|
||||||
Accept pipeline input: False
|
Accept pipeline input: False
|
||||||
Accept wildcard characters: False
|
Accept wildcard characters: False
|
||||||
|
|
@ -62,13 +65,8 @@ Accept wildcard characters: False
|
||||||
|
|
||||||
## INPUTS
|
## INPUTS
|
||||||
|
|
||||||
### None
|
|
||||||
|
|
||||||
|
|
||||||
## OUTPUTS
|
## OUTPUTS
|
||||||
|
|
||||||
### System.Object
|
|
||||||
|
|
||||||
## NOTES
|
## NOTES
|
||||||
|
|
||||||
## RELATED LINKS
|
## RELATED LINKS
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ schema: 2.0.0
|
||||||
# Get-Model
|
# Get-Model
|
||||||
|
|
||||||
## SYNOPSIS
|
## SYNOPSIS
|
||||||
{{Fill in the Synopsis}}
|
# Gets a list of Snipe-it Models
|
||||||
|
|
||||||
## SYNTAX
|
## SYNTAX
|
||||||
|
|
||||||
|
|
@ -21,17 +21,20 @@ Get-Model [-url] <String> [-apiKey] <String>
|
||||||
|
|
||||||
## EXAMPLES
|
## EXAMPLES
|
||||||
|
|
||||||
### Example 1
|
### -------------------------- EXAMPLE 1 --------------------------
|
||||||
```
|
```
|
||||||
PS C:\> {{ Add example code here }}
|
Get-Models -url "https://assets.example.com" -token "token..."
|
||||||
```
|
```
|
||||||
|
|
||||||
{{ Add example description here }}
|
### -------------------------- EXAMPLE 2 --------------------------
|
||||||
|
```
|
||||||
|
Get-Models -url "https://assets.example.com" -token "token..." | Where-Object {$_.name -eq "DL380" }
|
||||||
|
```
|
||||||
|
|
||||||
## PARAMETERS
|
## PARAMETERS
|
||||||
|
|
||||||
### -apiKey
|
### -url
|
||||||
{{Fill apiKey Description}}
|
URL of Snipeit system, can be set using Set-Info command
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
Type: String
|
Type: String
|
||||||
|
|
@ -45,8 +48,8 @@ Accept pipeline input: False
|
||||||
Accept wildcard characters: False
|
Accept wildcard characters: False
|
||||||
```
|
```
|
||||||
|
|
||||||
### -url
|
### -apiKey
|
||||||
{{Fill url Description}}
|
Users API Key for Snipeit, can be set using Set-Info command
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
Type: String
|
Type: String
|
||||||
|
|
@ -54,7 +57,7 @@ Parameter Sets: (All)
|
||||||
Aliases:
|
Aliases:
|
||||||
|
|
||||||
Required: True
|
Required: True
|
||||||
Position: 0
|
Position: 2
|
||||||
Default value: None
|
Default value: None
|
||||||
Accept pipeline input: False
|
Accept pipeline input: False
|
||||||
Accept wildcard characters: False
|
Accept wildcard characters: False
|
||||||
|
|
@ -62,13 +65,8 @@ Accept wildcard characters: False
|
||||||
|
|
||||||
## INPUTS
|
## INPUTS
|
||||||
|
|
||||||
### None
|
|
||||||
|
|
||||||
|
|
||||||
## OUTPUTS
|
## OUTPUTS
|
||||||
|
|
||||||
### System.Object
|
|
||||||
|
|
||||||
## NOTES
|
## NOTES
|
||||||
|
|
||||||
## RELATED LINKS
|
## RELATED LINKS
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ schema: 2.0.0
|
||||||
# Get-Status
|
# Get-Status
|
||||||
|
|
||||||
## SYNOPSIS
|
## SYNOPSIS
|
||||||
{{Fill in the Synopsis}}
|
# Gets a list of Snipe-it Status Labels
|
||||||
|
|
||||||
## SYNTAX
|
## SYNTAX
|
||||||
|
|
||||||
|
|
@ -21,17 +21,20 @@ Get-Status [-url] <String> [-apiKey] <String>
|
||||||
|
|
||||||
## EXAMPLES
|
## EXAMPLES
|
||||||
|
|
||||||
### Example 1
|
### -------------------------- EXAMPLE 1 --------------------------
|
||||||
```
|
```
|
||||||
PS C:\> {{ Add example code here }}
|
Get-Status -url "https://assets.example.com" -token "token..."
|
||||||
```
|
```
|
||||||
|
|
||||||
{{ Add example description here }}
|
### -------------------------- EXAMPLE 2 --------------------------
|
||||||
|
```
|
||||||
|
Get-Status -url "https://assets.example.com" -token "token..." | Where-Object {$_.name -eq "Ready to Deploy" }
|
||||||
|
```
|
||||||
|
|
||||||
## PARAMETERS
|
## PARAMETERS
|
||||||
|
|
||||||
### -apiKey
|
### -url
|
||||||
{{Fill apiKey Description}}
|
URL of Snipeit system, can be set using Set-Info command
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
Type: String
|
Type: String
|
||||||
|
|
@ -45,8 +48,8 @@ Accept pipeline input: False
|
||||||
Accept wildcard characters: False
|
Accept wildcard characters: False
|
||||||
```
|
```
|
||||||
|
|
||||||
### -url
|
### -apiKey
|
||||||
{{Fill url Description}}
|
Users API Key for Snipeit, can be set using Set-Info command
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
Type: String
|
Type: String
|
||||||
|
|
@ -54,7 +57,7 @@ Parameter Sets: (All)
|
||||||
Aliases:
|
Aliases:
|
||||||
|
|
||||||
Required: True
|
Required: True
|
||||||
Position: 0
|
Position: 2
|
||||||
Default value: None
|
Default value: None
|
||||||
Accept pipeline input: False
|
Accept pipeline input: False
|
||||||
Accept wildcard characters: False
|
Accept wildcard characters: False
|
||||||
|
|
@ -62,13 +65,8 @@ Accept wildcard characters: False
|
||||||
|
|
||||||
## INPUTS
|
## INPUTS
|
||||||
|
|
||||||
### None
|
|
||||||
|
|
||||||
|
|
||||||
## OUTPUTS
|
## OUTPUTS
|
||||||
|
|
||||||
### System.Object
|
|
||||||
|
|
||||||
## NOTES
|
## NOTES
|
||||||
|
|
||||||
## RELATED LINKS
|
## RELATED LINKS
|
||||||
|
|
|
||||||
|
|
@ -23,12 +23,12 @@ Get-User [-url] <String> [-apiKey] <String>
|
||||||
|
|
||||||
### -------------------------- EXAMPLE 1 --------------------------
|
### -------------------------- EXAMPLE 1 --------------------------
|
||||||
```
|
```
|
||||||
Get-Users -url "https://assets.dip.co.uk" -token "token..."
|
Get-User -url "https://assets.example.com" -token "token..."
|
||||||
```
|
```
|
||||||
|
|
||||||
### -------------------------- EXAMPLE 2 --------------------------
|
### -------------------------- EXAMPLE 2 --------------------------
|
||||||
```
|
```
|
||||||
Get-Users -url "https://assets.dip.co.uk" -token "token..." | Where-Object {$_.username -eq "stephenm" }
|
Get-User -url "https://assets.example.com" -token "token..." | Where-Object {$_.username -eq "stephenm" }
|
||||||
```
|
```
|
||||||
|
|
||||||
## PARAMETERS
|
## PARAMETERS
|
||||||
|
|
|
||||||
|
|
@ -8,46 +8,49 @@ schema: 2.0.0
|
||||||
# New-Asset
|
# New-Asset
|
||||||
|
|
||||||
## SYNOPSIS
|
## SYNOPSIS
|
||||||
{{Fill in the Synopsis}}
|
Add a new Asset to Snipe-it asset system
|
||||||
|
|
||||||
## SYNTAX
|
## SYNTAX
|
||||||
|
|
||||||
```
|
```
|
||||||
New-Asset [-Name] <String> [-Status_id] <String> [-Model_id] <String> [-url] <String> [-apiKey] <String>
|
New-Asset [[-tag] <String>] [-Name] <String> [-Status_id] <String> [-Model_id] <String> [-url] <String>
|
||||||
[[-customfields] <Hashtable>] [-WhatIf] [-Confirm]
|
[-apiKey] <String> [[-customfields] <Hashtable>] [-WhatIf] [-Confirm]
|
||||||
```
|
```
|
||||||
|
|
||||||
## DESCRIPTION
|
## DESCRIPTION
|
||||||
{{Fill in the Description}}
|
Long description
|
||||||
|
|
||||||
## EXAMPLES
|
## EXAMPLES
|
||||||
|
|
||||||
### Example 1
|
### -------------------------- EXAMPLE 1 --------------------------
|
||||||
```
|
```
|
||||||
PS C:\> {{ Add example code here }}
|
New-Asset -status_id 1 -model_id 1 -name "Machine1"
|
||||||
```
|
```
|
||||||
|
|
||||||
{{ Add example description here }}
|
### -------------------------- EXAMPLE 2 --------------------------
|
||||||
|
```
|
||||||
|
New-Asset -status_id 1 -model_id 1 -name "Machine1" -CustomValues = @{ "_snipeit_os_5 = "Windows 10 Pro" }
|
||||||
|
```
|
||||||
|
|
||||||
## PARAMETERS
|
## PARAMETERS
|
||||||
|
|
||||||
### -Confirm
|
### -tag
|
||||||
Prompts you for confirmation before running the cmdlet.
|
Asset Tag for the Asset
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
Type: SwitchParameter
|
Type: String
|
||||||
Parameter Sets: (All)
|
Parameter Sets: (All)
|
||||||
Aliases: cf
|
Aliases:
|
||||||
|
|
||||||
Required: False
|
Required: False
|
||||||
Position: Named
|
Position: 1
|
||||||
Default value: None
|
Default value: None
|
||||||
Accept pipeline input: False
|
Accept pipeline input: False
|
||||||
Accept wildcard characters: False
|
Accept wildcard characters: False
|
||||||
```
|
```
|
||||||
|
|
||||||
### -Model_id
|
### -Name
|
||||||
{{Fill Model_id Description}}
|
Name of the Asset
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
Type: String
|
Type: String
|
||||||
|
|
@ -61,8 +64,8 @@ Accept pipeline input: False
|
||||||
Accept wildcard characters: False
|
Accept wildcard characters: False
|
||||||
```
|
```
|
||||||
|
|
||||||
### -Name
|
### -Status_id
|
||||||
{{Fill Name Description}}
|
Status ID of the asset, this can be got using Get-Status
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
Type: String
|
Type: String
|
||||||
|
|
@ -70,14 +73,14 @@ Parameter Sets: (All)
|
||||||
Aliases:
|
Aliases:
|
||||||
|
|
||||||
Required: True
|
Required: True
|
||||||
Position: 0
|
Position: 3
|
||||||
Default value: None
|
Default value: None
|
||||||
Accept pipeline input: False
|
Accept pipeline input: False
|
||||||
Accept wildcard characters: False
|
Accept wildcard characters: False
|
||||||
```
|
```
|
||||||
|
|
||||||
### -Status_id
|
### -Model_id
|
||||||
{{Fill Status_id Description}}
|
Model ID of the asset, this can be got using Get-Model
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
Type: String
|
Type: String
|
||||||
|
|
@ -85,7 +88,52 @@ Parameter Sets: (All)
|
||||||
Aliases:
|
Aliases:
|
||||||
|
|
||||||
Required: True
|
Required: True
|
||||||
Position: 1
|
Position: 4
|
||||||
|
Default value: None
|
||||||
|
Accept pipeline input: False
|
||||||
|
Accept wildcard characters: False
|
||||||
|
```
|
||||||
|
|
||||||
|
### -url
|
||||||
|
URL of Snipeit system, can be set using Set-Info command
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
Type: String
|
||||||
|
Parameter Sets: (All)
|
||||||
|
Aliases:
|
||||||
|
|
||||||
|
Required: True
|
||||||
|
Position: 5
|
||||||
|
Default value: None
|
||||||
|
Accept pipeline input: False
|
||||||
|
Accept wildcard characters: False
|
||||||
|
```
|
||||||
|
|
||||||
|
### -apiKey
|
||||||
|
Users API Key for Snipeit, can be set using Set-Info command
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
Type: String
|
||||||
|
Parameter Sets: (All)
|
||||||
|
Aliases:
|
||||||
|
|
||||||
|
Required: True
|
||||||
|
Position: 6
|
||||||
|
Default value: None
|
||||||
|
Accept pipeline input: False
|
||||||
|
Accept wildcard characters: False
|
||||||
|
```
|
||||||
|
|
||||||
|
### -customfields
|
||||||
|
Hastable of custom fields and extra fields that need passing through to Snipeit
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
Type: Hashtable
|
||||||
|
Parameter Sets: (All)
|
||||||
|
Aliases:
|
||||||
|
|
||||||
|
Required: False
|
||||||
|
Position: 7
|
||||||
Default value: None
|
Default value: None
|
||||||
Accept pipeline input: False
|
Accept pipeline input: False
|
||||||
Accept wildcard characters: False
|
Accept wildcard characters: False
|
||||||
|
|
@ -107,46 +155,16 @@ Accept pipeline input: False
|
||||||
Accept wildcard characters: False
|
Accept wildcard characters: False
|
||||||
```
|
```
|
||||||
|
|
||||||
### -apiKey
|
### -Confirm
|
||||||
{{Fill apiKey Description}}
|
Prompts you for confirmation before running the cmdlet.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
Type: String
|
Type: SwitchParameter
|
||||||
Parameter Sets: (All)
|
Parameter Sets: (All)
|
||||||
Aliases:
|
Aliases: cf
|
||||||
|
|
||||||
Required: True
|
|
||||||
Position: 4
|
|
||||||
Default value: None
|
|
||||||
Accept pipeline input: False
|
|
||||||
Accept wildcard characters: False
|
|
||||||
```
|
|
||||||
|
|
||||||
### -customfields
|
|
||||||
{{Fill customfields Description}}
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
Type: Hashtable
|
|
||||||
Parameter Sets: (All)
|
|
||||||
Aliases:
|
|
||||||
|
|
||||||
Required: False
|
Required: False
|
||||||
Position: 5
|
Position: Named
|
||||||
Default value: None
|
|
||||||
Accept pipeline input: False
|
|
||||||
Accept wildcard characters: False
|
|
||||||
```
|
|
||||||
|
|
||||||
### -url
|
|
||||||
{{Fill url Description}}
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
Type: String
|
|
||||||
Parameter Sets: (All)
|
|
||||||
Aliases:
|
|
||||||
|
|
||||||
Required: True
|
|
||||||
Position: 3
|
|
||||||
Default value: None
|
Default value: None
|
||||||
Accept pipeline input: False
|
Accept pipeline input: False
|
||||||
Accept wildcard characters: False
|
Accept wildcard characters: False
|
||||||
|
|
@ -154,13 +172,8 @@ Accept wildcard characters: False
|
||||||
|
|
||||||
## INPUTS
|
## INPUTS
|
||||||
|
|
||||||
### None
|
|
||||||
|
|
||||||
|
|
||||||
## OUTPUTS
|
## OUTPUTS
|
||||||
|
|
||||||
### System.Object
|
|
||||||
|
|
||||||
## NOTES
|
## NOTES
|
||||||
|
|
||||||
## RELATED LINKS
|
## RELATED LINKS
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ schema: 2.0.0
|
||||||
# New-Component
|
# New-Component
|
||||||
|
|
||||||
## SYNOPSIS
|
## SYNOPSIS
|
||||||
{{Fill in the Synopsis}}
|
Short description
|
||||||
|
|
||||||
## SYNTAX
|
## SYNTAX
|
||||||
|
|
||||||
|
|
@ -18,29 +18,87 @@ New-Component [-name] <String> [-category_id] <String> [-qty] <String> [-url] <S
|
||||||
```
|
```
|
||||||
|
|
||||||
## DESCRIPTION
|
## DESCRIPTION
|
||||||
{{Fill in the Description}}
|
Long description
|
||||||
|
|
||||||
## EXAMPLES
|
## EXAMPLES
|
||||||
|
|
||||||
### Example 1
|
### -------------------------- EXAMPLE 1 --------------------------
|
||||||
```
|
```
|
||||||
PS C:\> {{ Add example code here }}
|
An example
|
||||||
```
|
```
|
||||||
|
|
||||||
{{ Add example description here }}
|
|
||||||
|
|
||||||
## PARAMETERS
|
## PARAMETERS
|
||||||
|
|
||||||
### -Confirm
|
### -name
|
||||||
Prompts you for confirmation before running the cmdlet.
|
Parameter description
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
Type: SwitchParameter
|
Type: String
|
||||||
Parameter Sets: (All)
|
Parameter Sets: (All)
|
||||||
Aliases: cf
|
Aliases:
|
||||||
|
|
||||||
Required: False
|
Required: True
|
||||||
Position: Named
|
Position: 1
|
||||||
|
Default value: None
|
||||||
|
Accept pipeline input: False
|
||||||
|
Accept wildcard characters: False
|
||||||
|
```
|
||||||
|
|
||||||
|
### -category_id
|
||||||
|
Parameter description
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
Type: String
|
||||||
|
Parameter Sets: (All)
|
||||||
|
Aliases:
|
||||||
|
|
||||||
|
Required: True
|
||||||
|
Position: 2
|
||||||
|
Default value: None
|
||||||
|
Accept pipeline input: False
|
||||||
|
Accept wildcard characters: False
|
||||||
|
```
|
||||||
|
|
||||||
|
### -qty
|
||||||
|
Parameter description
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
Type: String
|
||||||
|
Parameter Sets: (All)
|
||||||
|
Aliases:
|
||||||
|
|
||||||
|
Required: True
|
||||||
|
Position: 3
|
||||||
|
Default value: None
|
||||||
|
Accept pipeline input: False
|
||||||
|
Accept wildcard characters: False
|
||||||
|
```
|
||||||
|
|
||||||
|
### -url
|
||||||
|
Parameter description
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
Type: String
|
||||||
|
Parameter Sets: (All)
|
||||||
|
Aliases:
|
||||||
|
|
||||||
|
Required: True
|
||||||
|
Position: 4
|
||||||
|
Default value: None
|
||||||
|
Accept pipeline input: False
|
||||||
|
Accept wildcard characters: False
|
||||||
|
```
|
||||||
|
|
||||||
|
### -apiKey
|
||||||
|
Parameter description
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
Type: String
|
||||||
|
Parameter Sets: (All)
|
||||||
|
Aliases:
|
||||||
|
|
||||||
|
Required: True
|
||||||
|
Position: 5
|
||||||
Default value: None
|
Default value: None
|
||||||
Accept pipeline input: False
|
Accept pipeline input: False
|
||||||
Accept wildcard characters: False
|
Accept wildcard characters: False
|
||||||
|
|
@ -62,76 +120,16 @@ Accept pipeline input: False
|
||||||
Accept wildcard characters: False
|
Accept wildcard characters: False
|
||||||
```
|
```
|
||||||
|
|
||||||
### -apiKey
|
### -Confirm
|
||||||
{{Fill apiKey Description}}
|
Prompts you for confirmation before running the cmdlet.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
Type: String
|
Type: SwitchParameter
|
||||||
Parameter Sets: (All)
|
Parameter Sets: (All)
|
||||||
Aliases:
|
Aliases: cf
|
||||||
|
|
||||||
Required: True
|
Required: False
|
||||||
Position: 4
|
Position: Named
|
||||||
Default value: None
|
|
||||||
Accept pipeline input: False
|
|
||||||
Accept wildcard characters: False
|
|
||||||
```
|
|
||||||
|
|
||||||
### -category_id
|
|
||||||
{{Fill category_id Description}}
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
Type: String
|
|
||||||
Parameter Sets: (All)
|
|
||||||
Aliases:
|
|
||||||
|
|
||||||
Required: True
|
|
||||||
Position: 1
|
|
||||||
Default value: None
|
|
||||||
Accept pipeline input: False
|
|
||||||
Accept wildcard characters: False
|
|
||||||
```
|
|
||||||
|
|
||||||
### -name
|
|
||||||
{{Fill name Description}}
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
Type: String
|
|
||||||
Parameter Sets: (All)
|
|
||||||
Aliases:
|
|
||||||
|
|
||||||
Required: True
|
|
||||||
Position: 0
|
|
||||||
Default value: None
|
|
||||||
Accept pipeline input: False
|
|
||||||
Accept wildcard characters: False
|
|
||||||
```
|
|
||||||
|
|
||||||
### -qty
|
|
||||||
{{Fill qty Description}}
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
Type: String
|
|
||||||
Parameter Sets: (All)
|
|
||||||
Aliases:
|
|
||||||
|
|
||||||
Required: True
|
|
||||||
Position: 2
|
|
||||||
Default value: None
|
|
||||||
Accept pipeline input: False
|
|
||||||
Accept wildcard characters: False
|
|
||||||
```
|
|
||||||
|
|
||||||
### -url
|
|
||||||
{{Fill url Description}}
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
Type: String
|
|
||||||
Parameter Sets: (All)
|
|
||||||
Aliases:
|
|
||||||
|
|
||||||
Required: True
|
|
||||||
Position: 3
|
|
||||||
Default value: None
|
Default value: None
|
||||||
Accept pipeline input: False
|
Accept pipeline input: False
|
||||||
Accept wildcard characters: False
|
Accept wildcard characters: False
|
||||||
|
|
@ -139,14 +137,10 @@ Accept wildcard characters: False
|
||||||
|
|
||||||
## INPUTS
|
## INPUTS
|
||||||
|
|
||||||
### None
|
|
||||||
|
|
||||||
|
|
||||||
## OUTPUTS
|
## OUTPUTS
|
||||||
|
|
||||||
### System.Object
|
|
||||||
|
|
||||||
## NOTES
|
## NOTES
|
||||||
|
General notes
|
||||||
|
|
||||||
## RELATED LINKS
|
## RELATED LINKS
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ schema: 2.0.0
|
||||||
# New-Manufacturer
|
# New-Manufacturer
|
||||||
|
|
||||||
## SYNOPSIS
|
## SYNOPSIS
|
||||||
{{Fill in the Synopsis}}
|
Add a new Manufacturer to Snipe-it asset system
|
||||||
|
|
||||||
## SYNTAX
|
## SYNTAX
|
||||||
|
|
||||||
|
|
@ -17,36 +17,19 @@ New-Manufacturer [-Name] <String> [-url] <String> [-apiKey] <String> [-WhatIf] [
|
||||||
```
|
```
|
||||||
|
|
||||||
## DESCRIPTION
|
## DESCRIPTION
|
||||||
{{Fill in the Description}}
|
Long description
|
||||||
|
|
||||||
## EXAMPLES
|
## EXAMPLES
|
||||||
|
|
||||||
### Example 1
|
### -------------------------- EXAMPLE 1 --------------------------
|
||||||
```
|
```
|
||||||
PS C:\> {{ Add example code here }}
|
New-Manufacturer -name "HP"
|
||||||
```
|
```
|
||||||
|
|
||||||
{{ Add example description here }}
|
|
||||||
|
|
||||||
## PARAMETERS
|
## PARAMETERS
|
||||||
|
|
||||||
### -Confirm
|
|
||||||
Prompts you for confirmation before running the cmdlet.
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
Type: SwitchParameter
|
|
||||||
Parameter Sets: (All)
|
|
||||||
Aliases: cf
|
|
||||||
|
|
||||||
Required: False
|
|
||||||
Position: Named
|
|
||||||
Default value: None
|
|
||||||
Accept pipeline input: False
|
|
||||||
Accept wildcard characters: False
|
|
||||||
```
|
|
||||||
|
|
||||||
### -Name
|
### -Name
|
||||||
{{Fill Name Description}}
|
Name of the Manufacturer
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
Type: String
|
Type: String
|
||||||
|
|
@ -54,7 +37,37 @@ Parameter Sets: (All)
|
||||||
Aliases:
|
Aliases:
|
||||||
|
|
||||||
Required: True
|
Required: True
|
||||||
Position: 0
|
Position: 1
|
||||||
|
Default value: None
|
||||||
|
Accept pipeline input: False
|
||||||
|
Accept wildcard characters: False
|
||||||
|
```
|
||||||
|
|
||||||
|
### -url
|
||||||
|
URL of Snipeit system, can be set using Set-Info command
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
Type: String
|
||||||
|
Parameter Sets: (All)
|
||||||
|
Aliases:
|
||||||
|
|
||||||
|
Required: True
|
||||||
|
Position: 2
|
||||||
|
Default value: None
|
||||||
|
Accept pipeline input: False
|
||||||
|
Accept wildcard characters: False
|
||||||
|
```
|
||||||
|
|
||||||
|
### -apiKey
|
||||||
|
Users API Key for Snipeit, can be set using Set-Info command
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
Type: String
|
||||||
|
Parameter Sets: (All)
|
||||||
|
Aliases:
|
||||||
|
|
||||||
|
Required: True
|
||||||
|
Position: 3
|
||||||
Default value: None
|
Default value: None
|
||||||
Accept pipeline input: False
|
Accept pipeline input: False
|
||||||
Accept wildcard characters: False
|
Accept wildcard characters: False
|
||||||
|
|
@ -76,31 +89,16 @@ Accept pipeline input: False
|
||||||
Accept wildcard characters: False
|
Accept wildcard characters: False
|
||||||
```
|
```
|
||||||
|
|
||||||
### -apiKey
|
### -Confirm
|
||||||
{{Fill apiKey Description}}
|
Prompts you for confirmation before running the cmdlet.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
Type: String
|
Type: SwitchParameter
|
||||||
Parameter Sets: (All)
|
Parameter Sets: (All)
|
||||||
Aliases:
|
Aliases: cf
|
||||||
|
|
||||||
Required: True
|
Required: False
|
||||||
Position: 2
|
Position: Named
|
||||||
Default value: None
|
|
||||||
Accept pipeline input: False
|
|
||||||
Accept wildcard characters: False
|
|
||||||
```
|
|
||||||
|
|
||||||
### -url
|
|
||||||
{{Fill url Description}}
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
Type: String
|
|
||||||
Parameter Sets: (All)
|
|
||||||
Aliases:
|
|
||||||
|
|
||||||
Required: True
|
|
||||||
Position: 1
|
|
||||||
Default value: None
|
Default value: None
|
||||||
Accept pipeline input: False
|
Accept pipeline input: False
|
||||||
Accept wildcard characters: False
|
Accept wildcard characters: False
|
||||||
|
|
@ -108,13 +106,8 @@ Accept wildcard characters: False
|
||||||
|
|
||||||
## INPUTS
|
## INPUTS
|
||||||
|
|
||||||
### None
|
|
||||||
|
|
||||||
|
|
||||||
## OUTPUTS
|
## OUTPUTS
|
||||||
|
|
||||||
### System.Object
|
|
||||||
|
|
||||||
## NOTES
|
## NOTES
|
||||||
|
|
||||||
## RELATED LINKS
|
## RELATED LINKS
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ schema: 2.0.0
|
||||||
# New-Model
|
# New-Model
|
||||||
|
|
||||||
## SYNOPSIS
|
## SYNOPSIS
|
||||||
{{Fill in the Synopsis}}
|
Add a new Model to Snipe-it asset system
|
||||||
|
|
||||||
## SYNTAX
|
## SYNTAX
|
||||||
|
|
||||||
|
|
@ -18,29 +18,102 @@ New-Model [-name] <String> [-category_id] <Int32> [-manufacturer_id] <Int32> [-f
|
||||||
```
|
```
|
||||||
|
|
||||||
## DESCRIPTION
|
## DESCRIPTION
|
||||||
{{Fill in the Description}}
|
Long description
|
||||||
|
|
||||||
## EXAMPLES
|
## EXAMPLES
|
||||||
|
|
||||||
### Example 1
|
### -------------------------- EXAMPLE 1 --------------------------
|
||||||
```
|
```
|
||||||
PS C:\> {{ Add example code here }}
|
New-Model -name "DL380" -manufacturer_id 2 -fieldset_id 2 -category_id 1
|
||||||
```
|
```
|
||||||
|
|
||||||
{{ Add example description here }}
|
|
||||||
|
|
||||||
## PARAMETERS
|
## PARAMETERS
|
||||||
|
|
||||||
### -Confirm
|
### -name
|
||||||
Prompts you for confirmation before running the cmdlet.
|
Name of the Asset Model
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
Type: SwitchParameter
|
Type: String
|
||||||
Parameter Sets: (All)
|
Parameter Sets: (All)
|
||||||
Aliases: cf
|
Aliases:
|
||||||
|
|
||||||
Required: False
|
Required: True
|
||||||
Position: Named
|
Position: 1
|
||||||
|
Default value: None
|
||||||
|
Accept pipeline input: False
|
||||||
|
Accept wildcard characters: False
|
||||||
|
```
|
||||||
|
|
||||||
|
### -category_id
|
||||||
|
Category ID that the asset belongs to this can be got using Get-Category
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
Type: Int32
|
||||||
|
Parameter Sets: (All)
|
||||||
|
Aliases:
|
||||||
|
|
||||||
|
Required: True
|
||||||
|
Position: 2
|
||||||
|
Default value: 0
|
||||||
|
Accept pipeline input: False
|
||||||
|
Accept wildcard characters: False
|
||||||
|
```
|
||||||
|
|
||||||
|
### -manufacturer_id
|
||||||
|
Manufacturer ID that the asset belongs to this can be got using Get-Manufacturer
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
Type: Int32
|
||||||
|
Parameter Sets: (All)
|
||||||
|
Aliases:
|
||||||
|
|
||||||
|
Required: True
|
||||||
|
Position: 3
|
||||||
|
Default value: 0
|
||||||
|
Accept pipeline input: False
|
||||||
|
Accept wildcard characters: False
|
||||||
|
```
|
||||||
|
|
||||||
|
### -fieldset_id
|
||||||
|
Fieldset ID that the asset uses (Custom fields)
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
Type: Int32
|
||||||
|
Parameter Sets: (All)
|
||||||
|
Aliases:
|
||||||
|
|
||||||
|
Required: True
|
||||||
|
Position: 4
|
||||||
|
Default value: 0
|
||||||
|
Accept pipeline input: False
|
||||||
|
Accept wildcard characters: False
|
||||||
|
```
|
||||||
|
|
||||||
|
### -url
|
||||||
|
URL of Snipeit system, can be set using Set-Info command
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
Type: String
|
||||||
|
Parameter Sets: (All)
|
||||||
|
Aliases:
|
||||||
|
|
||||||
|
Required: True
|
||||||
|
Position: 5
|
||||||
|
Default value: None
|
||||||
|
Accept pipeline input: False
|
||||||
|
Accept wildcard characters: False
|
||||||
|
```
|
||||||
|
|
||||||
|
### -apiKey
|
||||||
|
Users API Key for Snipeit, can be set using Set-Info command
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
Type: String
|
||||||
|
Parameter Sets: (All)
|
||||||
|
Aliases:
|
||||||
|
|
||||||
|
Required: True
|
||||||
|
Position: 6
|
||||||
Default value: None
|
Default value: None
|
||||||
Accept pipeline input: False
|
Accept pipeline input: False
|
||||||
Accept wildcard characters: False
|
Accept wildcard characters: False
|
||||||
|
|
@ -62,91 +135,16 @@ Accept pipeline input: False
|
||||||
Accept wildcard characters: False
|
Accept wildcard characters: False
|
||||||
```
|
```
|
||||||
|
|
||||||
### -apiKey
|
### -Confirm
|
||||||
{{Fill apiKey Description}}
|
Prompts you for confirmation before running the cmdlet.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
Type: String
|
Type: SwitchParameter
|
||||||
Parameter Sets: (All)
|
Parameter Sets: (All)
|
||||||
Aliases:
|
Aliases: cf
|
||||||
|
|
||||||
Required: True
|
Required: False
|
||||||
Position: 5
|
Position: Named
|
||||||
Default value: None
|
|
||||||
Accept pipeline input: False
|
|
||||||
Accept wildcard characters: False
|
|
||||||
```
|
|
||||||
|
|
||||||
### -category_id
|
|
||||||
{{Fill category_id Description}}
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
Type: Int32
|
|
||||||
Parameter Sets: (All)
|
|
||||||
Aliases:
|
|
||||||
|
|
||||||
Required: True
|
|
||||||
Position: 1
|
|
||||||
Default value: None
|
|
||||||
Accept pipeline input: False
|
|
||||||
Accept wildcard characters: False
|
|
||||||
```
|
|
||||||
|
|
||||||
### -fieldset_id
|
|
||||||
{{Fill fieldset_id Description}}
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
Type: Int32
|
|
||||||
Parameter Sets: (All)
|
|
||||||
Aliases:
|
|
||||||
|
|
||||||
Required: True
|
|
||||||
Position: 3
|
|
||||||
Default value: None
|
|
||||||
Accept pipeline input: False
|
|
||||||
Accept wildcard characters: False
|
|
||||||
```
|
|
||||||
|
|
||||||
### -manufacturer_id
|
|
||||||
{{Fill manufacturer_id Description}}
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
Type: Int32
|
|
||||||
Parameter Sets: (All)
|
|
||||||
Aliases:
|
|
||||||
|
|
||||||
Required: True
|
|
||||||
Position: 2
|
|
||||||
Default value: None
|
|
||||||
Accept pipeline input: False
|
|
||||||
Accept wildcard characters: False
|
|
||||||
```
|
|
||||||
|
|
||||||
### -name
|
|
||||||
{{Fill name Description}}
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
Type: String
|
|
||||||
Parameter Sets: (All)
|
|
||||||
Aliases:
|
|
||||||
|
|
||||||
Required: True
|
|
||||||
Position: 0
|
|
||||||
Default value: None
|
|
||||||
Accept pipeline input: False
|
|
||||||
Accept wildcard characters: False
|
|
||||||
```
|
|
||||||
|
|
||||||
### -url
|
|
||||||
{{Fill url Description}}
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
Type: String
|
|
||||||
Parameter Sets: (All)
|
|
||||||
Aliases:
|
|
||||||
|
|
||||||
Required: True
|
|
||||||
Position: 4
|
|
||||||
Default value: None
|
Default value: None
|
||||||
Accept pipeline input: False
|
Accept pipeline input: False
|
||||||
Accept wildcard characters: False
|
Accept wildcard characters: False
|
||||||
|
|
@ -154,13 +152,8 @@ Accept wildcard characters: False
|
||||||
|
|
||||||
## INPUTS
|
## INPUTS
|
||||||
|
|
||||||
### None
|
|
||||||
|
|
||||||
|
|
||||||
## OUTPUTS
|
## OUTPUTS
|
||||||
|
|
||||||
### System.Object
|
|
||||||
|
|
||||||
## NOTES
|
## NOTES
|
||||||
|
|
||||||
## RELATED LINKS
|
## RELATED LINKS
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ schema: 2.0.0
|
||||||
# Set-Asset
|
# Set-Asset
|
||||||
|
|
||||||
## SYNOPSIS
|
## SYNOPSIS
|
||||||
{{Fill in the Synopsis}}
|
Update a Asset in the Snipe-it asset system
|
||||||
|
|
||||||
## SYNTAX
|
## SYNTAX
|
||||||
|
|
||||||
|
|
@ -18,36 +18,54 @@ Set-Asset [-id] <Int32> [-Name] <String> [-Status_id] <String> [-Model_id] <Stri
|
||||||
```
|
```
|
||||||
|
|
||||||
## DESCRIPTION
|
## DESCRIPTION
|
||||||
{{Fill in the Description}}
|
Long description
|
||||||
|
|
||||||
## EXAMPLES
|
## EXAMPLES
|
||||||
|
|
||||||
### Example 1
|
### -------------------------- EXAMPLE 1 --------------------------
|
||||||
```
|
```
|
||||||
PS C:\> {{ Add example code here }}
|
Set-Asset -id 1 -status_id 1 -model_id 1 -name "Machine1"
|
||||||
```
|
```
|
||||||
|
|
||||||
{{ Add example description here }}
|
### -------------------------- EXAMPLE 2 --------------------------
|
||||||
|
```
|
||||||
|
Set-Asset -id 1 -status_id 1 -model_id 1 -name "Machine1" -CustomValues = @{ "_snipeit_os_5 = "Windows 10 Pro" }
|
||||||
|
```
|
||||||
|
|
||||||
## PARAMETERS
|
## PARAMETERS
|
||||||
|
|
||||||
### -Confirm
|
### -id
|
||||||
Prompts you for confirmation before running the cmdlet.
|
ID of the Asset
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
Type: SwitchParameter
|
Type: Int32
|
||||||
Parameter Sets: (All)
|
Parameter Sets: (All)
|
||||||
Aliases: cf
|
Aliases:
|
||||||
|
|
||||||
Required: False
|
Required: True
|
||||||
Position: Named
|
Position: 1
|
||||||
|
Default value: 0
|
||||||
|
Accept pipeline input: False
|
||||||
|
Accept wildcard characters: False
|
||||||
|
```
|
||||||
|
|
||||||
|
### -Name
|
||||||
|
Name of the Asset
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
Type: String
|
||||||
|
Parameter Sets: (All)
|
||||||
|
Aliases:
|
||||||
|
|
||||||
|
Required: True
|
||||||
|
Position: 2
|
||||||
Default value: None
|
Default value: None
|
||||||
Accept pipeline input: False
|
Accept pipeline input: False
|
||||||
Accept wildcard characters: False
|
Accept wildcard characters: False
|
||||||
```
|
```
|
||||||
|
|
||||||
### -Model_id
|
### -Status_id
|
||||||
{{Fill Model_id Description}}
|
Status ID of the asset, this can be got using Get-Status
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
Type: String
|
Type: String
|
||||||
|
|
@ -61,8 +79,8 @@ Accept pipeline input: False
|
||||||
Accept wildcard characters: False
|
Accept wildcard characters: False
|
||||||
```
|
```
|
||||||
|
|
||||||
### -Name
|
### -Model_id
|
||||||
{{Fill Name Description}}
|
Model ID of the asset, this can be got using Get-Model
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
Type: String
|
Type: String
|
||||||
|
|
@ -70,14 +88,14 @@ Parameter Sets: (All)
|
||||||
Aliases:
|
Aliases:
|
||||||
|
|
||||||
Required: True
|
Required: True
|
||||||
Position: 1
|
Position: 4
|
||||||
Default value: None
|
Default value: None
|
||||||
Accept pipeline input: False
|
Accept pipeline input: False
|
||||||
Accept wildcard characters: False
|
Accept wildcard characters: False
|
||||||
```
|
```
|
||||||
|
|
||||||
### -Status_id
|
### -url
|
||||||
{{Fill Status_id Description}}
|
URL of Snipeit system, can be set using Set-Info command
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
Type: String
|
Type: String
|
||||||
|
|
@ -85,7 +103,37 @@ Parameter Sets: (All)
|
||||||
Aliases:
|
Aliases:
|
||||||
|
|
||||||
Required: True
|
Required: True
|
||||||
Position: 2
|
Position: 5
|
||||||
|
Default value: None
|
||||||
|
Accept pipeline input: False
|
||||||
|
Accept wildcard characters: False
|
||||||
|
```
|
||||||
|
|
||||||
|
### -apiKey
|
||||||
|
Users API Key for Snipeit, can be set using Set-Info command
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
Type: String
|
||||||
|
Parameter Sets: (All)
|
||||||
|
Aliases:
|
||||||
|
|
||||||
|
Required: True
|
||||||
|
Position: 6
|
||||||
|
Default value: None
|
||||||
|
Accept pipeline input: False
|
||||||
|
Accept wildcard characters: False
|
||||||
|
```
|
||||||
|
|
||||||
|
### -customfields
|
||||||
|
Hastable of custom fields and extra fields that need passing through to Snipeit
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
Type: Hashtable
|
||||||
|
Parameter Sets: (All)
|
||||||
|
Aliases:
|
||||||
|
|
||||||
|
Required: False
|
||||||
|
Position: 7
|
||||||
Default value: None
|
Default value: None
|
||||||
Accept pipeline input: False
|
Accept pipeline input: False
|
||||||
Accept wildcard characters: False
|
Accept wildcard characters: False
|
||||||
|
|
@ -107,61 +155,16 @@ Accept pipeline input: False
|
||||||
Accept wildcard characters: False
|
Accept wildcard characters: False
|
||||||
```
|
```
|
||||||
|
|
||||||
### -apiKey
|
### -Confirm
|
||||||
{{Fill apiKey Description}}
|
Prompts you for confirmation before running the cmdlet.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
Type: String
|
Type: SwitchParameter
|
||||||
Parameter Sets: (All)
|
Parameter Sets: (All)
|
||||||
Aliases:
|
Aliases: cf
|
||||||
|
|
||||||
Required: True
|
|
||||||
Position: 5
|
|
||||||
Default value: None
|
|
||||||
Accept pipeline input: False
|
|
||||||
Accept wildcard characters: False
|
|
||||||
```
|
|
||||||
|
|
||||||
### -customfields
|
|
||||||
{{Fill customfields Description}}
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
Type: Hashtable
|
|
||||||
Parameter Sets: (All)
|
|
||||||
Aliases:
|
|
||||||
|
|
||||||
Required: False
|
Required: False
|
||||||
Position: 6
|
Position: Named
|
||||||
Default value: None
|
|
||||||
Accept pipeline input: False
|
|
||||||
Accept wildcard characters: False
|
|
||||||
```
|
|
||||||
|
|
||||||
### -id
|
|
||||||
{{Fill id Description}}
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
Type: Int32
|
|
||||||
Parameter Sets: (All)
|
|
||||||
Aliases:
|
|
||||||
|
|
||||||
Required: True
|
|
||||||
Position: 0
|
|
||||||
Default value: None
|
|
||||||
Accept pipeline input: False
|
|
||||||
Accept wildcard characters: False
|
|
||||||
```
|
|
||||||
|
|
||||||
### -url
|
|
||||||
{{Fill url Description}}
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
Type: String
|
|
||||||
Parameter Sets: (All)
|
|
||||||
Aliases:
|
|
||||||
|
|
||||||
Required: True
|
|
||||||
Position: 4
|
|
||||||
Default value: None
|
Default value: None
|
||||||
Accept pipeline input: False
|
Accept pipeline input: False
|
||||||
Accept wildcard characters: False
|
Accept wildcard characters: False
|
||||||
|
|
@ -169,13 +172,8 @@ Accept wildcard characters: False
|
||||||
|
|
||||||
## INPUTS
|
## INPUTS
|
||||||
|
|
||||||
### None
|
|
||||||
|
|
||||||
|
|
||||||
## OUTPUTS
|
## OUTPUTS
|
||||||
|
|
||||||
### System.Object
|
|
||||||
|
|
||||||
## NOTES
|
## NOTES
|
||||||
|
|
||||||
## RELATED LINKS
|
## RELATED LINKS
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue