This commit is contained in:
Stephen Maunder 2017-11-19 10:57:26 +00:00
commit 4953d42f57
31 changed files with 2002 additions and 68 deletions

17
.vscode/launch.json vendored
View file

@ -1,6 +1,17 @@
{
"version": "0.2.0",
<<<<<<< HEAD
"configurations": [{
=======
"configurations": [
{
"type": "PowerShell",
"request": "launch",
"name": "PowerShell Interactive Session",
"cwd": "${workspaceRoot}"
},
{
>>>>>>> 13ec3a62ac71275ec2bbe0bbf993130e9f53589f
"type": "PowerShell",
"request": "launch",
"name": "PowerShell Pester Tests",
@ -15,6 +26,7 @@
"script": "${file}",
"args": [],
"cwd": "${file}"
<<<<<<< HEAD
},
{
"type": "PowerShell",
@ -31,3 +43,8 @@
}
]
}
=======
}
]
}
>>>>>>> 13ec3a62ac71275ec2bbe0bbf993130e9f53589f

View file

@ -1,3 +1,4 @@
<<<<<<< HEAD
# Change Log
All notable changes to this project will be documented in this file.
@ -6,3 +7,6 @@ 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
=======
[1.0]
>>>>>>> 13ec3a62ac71275ec2bbe0bbf993130e9f53589f

21
LICENSE Normal file
View file

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2016 Brian Bunke
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

1
README.md Normal file
View file

@ -0,0 +1 @@
[![Build status](https://ci.appveyor.com/api/projects/status/dvuw4ggx543nx3h7?svg=true)](https://ci.appveyor.com/project/snazy2000/snipeitps)

View file

@ -99,7 +99,11 @@ task TestPS5 {
}
# Synopsis: Invoke Pester Tests
<<<<<<< HEAD
task PesterTests, {
=======
task PesterTests CreateHelp, {
>>>>>>> 13ec3a62ac71275ec2bbe0bbf993130e9f53589f
try {
$result = Invoke-Pester -PassThru -OutputFile "$BuildRoot\TestResult.xml" -OutputFormat "NUnitXml"
if ($env:APPVEYOR_PROJECT_NAME) {
@ -118,9 +122,20 @@ task PesterTests, {
# Synopsis: Build shippable release
task Build GenerateRelease, ConvertMarkdown, UpdateManifest
<<<<<<< HEAD
# Synopsis: Generate .\Release structure
task GenerateRelease, {
=======
task CreateHelp {
Import-Module platyPS -Force
New-ExternalHelp -Path "$BuildRoot\docs" -OutputPath "$BuildRoot\SnipeitPS\en-US" -Force
Remove-Module SnipeitPS, platyPS
}
# Synopsis: Generate .\Release structure
task GenerateRelease CreateHelp, {
>>>>>>> 13ec3a62ac71275ec2bbe0bbf993130e9f53589f
# Setup
if (-not (Test-Path "$releasePath\SnipeitPS")) {
$null = New-Item -Path "$releasePath\SnipeitPS" -ItemType Directory
@ -140,7 +155,10 @@ task GenerateRelease, {
# Synopsis: Update the manifest of the module
task UpdateManifest GetVersion, {
Update-Metadata -Path "$releasePath\SnipeitPS\SnipeitPS.psd1" -PropertyName ModuleVersion -Value $script:Version
<<<<<<< HEAD
# Update-Metadata -Path "$releasePath\SnipeitPS\SnipeitPS.psd1" -PropertyName FileList -Value (Get-ChildItem $releasePath\SnipeitPS -Recurse).Name
=======
>>>>>>> 13ec3a62ac71275ec2bbe0bbf993130e9f53589f
$functionsToExport = Get-ChildItem "$BuildRoot\SnipeitPS\Public" | ForEach-Object {$_.BaseName}
Set-ModuleFunctions -Name "$releasePath\SnipeitPS\SnipeitPS.psd1" -FunctionsToExport $functionsToExport
}
@ -163,8 +181,58 @@ task GetVersion {
$newRevision
}
<<<<<<< HEAD
=======
# Synopsis: Convert markdown files to HTML.
# <http://johnmacfarlane.net/pandoc/>
$ConvertMarkdown = @{
Inputs = { Get-ChildItem "$releasePath\SnipeitPS\*.md" -Recurse }
Outputs = {process {
[System.IO.Path]::ChangeExtension($_, 'htm')
}
}
}
# Synopsis: Converts *.md and *.markdown files to *.htm
task ConvertMarkdown -Partial @ConvertMarkdown InstallPandoc, {process {
exec { Tools\pandoc.exe $_ --standalone --from=markdown_github "--output=$2" }
}
}, RemoveMarkdownFiles
>>>>>>> 13ec3a62ac71275ec2bbe0bbf993130e9f53589f
# endregion
# region publish
task Deploy -If (
# Only deploy if the master branch changes
$env:APPVEYOR_REPO_BRANCH -eq 'master' -and
# Do not deploy if this is a pull request (because it hasn't been approved yet)
(-not ($env:APPVEYOR_PULL_REQUEST_NUMBER)) -and
# Do not deploy if the commit contains the string "skip-deploy"
# Meant for major/minor version publishes with a .0 build/patch version (like 2.1.0)
$env:APPVEYOR_REPO_COMMIT_MESSAGE -notlike '*skip-deploy*'
) {
Remove-Module SnipeitPS -ErrorAction SilentlyContinue
}, PublishToGallery
task PublishToGallery {
assert ($env:PSGalleryAPIKey) "No key for the PSGallery"
Import-Module $releasePath\SnipeitPS\SnipeitPS.psd1 -ErrorAction Stop
Publish-Module -Name SnipeitPS -NuGetApiKey $env:PSGalleryAPIKey
}
# Synopsis: Push with a version tag.
task PushRelease GitStatus, GetVersion, {
# Done in appveyor.yml with deploy provider.
# This is needed, as I don't know how to athenticate (2-factor) in here.
exec { git checkout master }
$changes = exec { git status --short }
assert (!$changes) "Please, commit changes."
exec { git push }
exec { git tag -a "v$Version" -m "v$Version" }
exec { git push origin "v$Version" }
}
# endregion
#region Cleaning tasks
@ -176,10 +244,20 @@ task RemoveGeneratedFiles {
'Release'
'*.htm'
'TestResult.xml'
'SnipeitPS\en-US\*'
)
Remove-Item $itemsToRemove -Force -Recurse -ErrorAction 0
}
<<<<<<< HEAD
# endregion
task . ShowDebug, Clean, Test, Build, Deploy
=======
task RemoveMarkdownFiles {
Remove-Item "$releasePath\SnipeitPS\*.md" -Force -ErrorAction 0
}
# endregion
task . ShowDebug, Clean, Test, Build, Deploy
>>>>>>> 13ec3a62ac71275ec2bbe0bbf993130e9f53589f

View file

@ -0,0 +1,26 @@
function ConvertTo-GetParameter {
<#
.SYNOPSIS
Generate the GET parameter string for an URL from a hashtable
#>
[CmdletBinding()]
param (
[Parameter( Position = 0, Mandatory = $true, ValueFromPipeline = $true )]
[hashtable]$InputObject
)
BEGIN {
[string]$parameters = "?"
}
PROCESS {
Write-Verbose "[$($MyInvocation.MyCommand.Name)] Making HTTP get parameter string out of a hashtable"
foreach ($key in $InputObject.Keys) {
$parameters += "$key=$($InputObject[$key])&"
}
}
END {
$parameters -replace ".$"
}
}

View file

@ -19,7 +19,11 @@
[ValidateNotNullOrEmpty()]
[string]$Body,
[string] $Token
[string] $Token,
# GET Parameters
[Hashtable]$GetParameters
)
BEGIN {
@ -38,6 +42,14 @@
}
Process {
if ($GetParameters -and ($URi -notlike "*\?*"))
{
Write-Debug "Using `$GetParameters: $($GetParameters | Out-String)"
[string]$URI += (ConvertTo-GetParameter $GetParameters)
# Prevent recursive appends
$GetParameters = $null
}
# set mandatory parameters
$splatParameters = @{
Uri = $URi

View file

@ -35,6 +35,11 @@ function Get-Asset()
function New-Asset()
{
[CmdletBinding(
SupportsShouldProcess=$true,
ConfirmImpact="High"
)]
Param(
[parameter(mandatory=$true)]
[string]$Name,
@ -64,16 +69,27 @@ function New-Asset()
$Body = $Values | ConvertTo-Json;
$result = Invoke-Method -URi "$url/api/v1/hardware" `
-Method POST `
-Body $Body `
-Token $apiKey
$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,
@ -105,16 +121,27 @@ function Set-Asset()
$Values += $customfields
$Body = $Values | ConvertTo-Json;
$result = Invoke-Method -URi "$url/api/v1/hardware/$id" `
-Method PUT `
-Body $Body `
-Token $apiKey
$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,
@ -135,10 +162,16 @@ function Set-AssetOwner()
$Body = $Values | ConvertTo-Json;
$result = Invoke-Method -Uri "$url/api/v1/hardware/$id/checkout" `
-Method POST `
-Token $apiKey `
-Body $Body
$Parameters = @{
Uri = "$url/api/v1/hardware/$id/checkout"
Method = 'POST'
Body = $Body
Token = $apiKey
}
If ($PSCmdlet.ShouldProcess()) {
$result = Invoke-Method @Parameters
}
return $result
}

View file

@ -1,4 +1,4 @@
function Get-Categories()
function Get-Category()
{
Param(
[parameter(mandatory=$true)]

View file

@ -17,6 +17,11 @@ function Get-Component()
function New-Component()
{
[CmdletBinding(
SupportsShouldProcess=$true,
ConfirmImpact="High"
)]
Param(
[parameter(mandatory=$true)]
[string]$name,
@ -42,16 +47,27 @@ function New-Component()
$Body = $Values | ConvertTo-Json;
$result = Invoke-Method -URi "$url/api/v1/components" `
-Method POST `
-Body $Body `
-Token $apiKey
$Parameters = @{
Uri = "$url/api/v1/components"
Method = 'POST'
Body = $Body
Token = $apiKey
}
If ($PSCmdlet.ShouldProcess()) {
$result = Invoke-Method @Parameters
}
$result
}
function Update-Component()
function Set-Component()
{
[CmdletBinding(
SupportsShouldProcess=$true,
ConfirmImpact="High"
)]
Param(
[parameter(mandatory=$true)]
[string]$id,
@ -72,10 +88,16 @@ function Update-Component()
$Body = $Values | ConvertTo-Json;
$result = Invoke-Method -URi "$url/api/v1/components/$component_id" `
-Method Patch `
-Body $Body `
-Token $apiKey
$Parameters = @{
Uri = "$url/api/v1/components/$component_id"
Method = 'Patch'
Body = $Body
Token = $apiKey
}
If ($PSCmdlet.ShouldProcess()) {
$result = Invoke-Method @Parameters
}
$result
}

View file

@ -1,4 +1,4 @@
function Get-Manufacturers()
function Get-Manufacturer()
{
Param(
[parameter(mandatory=$true)]
@ -17,6 +17,11 @@ function Get-Manufacturers()
function New-Manufacturer()
{
[CmdletBinding(
SupportsShouldProcess=$true,
ConfirmImpact="High"
)]
Param(
[parameter(mandatory=$true)]
[string]$Name,
@ -36,10 +41,16 @@ function New-Manufacturer()
#Convert Values to JSON format
$Body = $Values | ConvertTo-Json;
$result = Invoke-Method -URi "$url/api/v1/manufacturers" `
-Method POST `
-Body $Body `
-Token $apiKey
$Parameters = @{
Uri = "$url/api/v1/manufacturers"
Method = 'post'
Body = $Body
Token = $apiKey
}
If ($PSCmdlet.ShouldProcess()) {
$result = Invoke-Method @Parameters
}
$result
}

View file

@ -1,5 +1,5 @@
function Get-Models()
function Get-Model()
{
Param(
[parameter(mandatory=$true)]
@ -19,6 +19,11 @@ function Get-Models()
function New-Model()
{
[CmdletBinding(
SupportsShouldProcess=$true,
ConfirmImpact="High"
)]
Param(
[parameter(mandatory=$true)]
[string]$name,
@ -48,10 +53,16 @@ function New-Model()
$Body = $Values | ConvertTo-Json;
$result = Invoke-Method -URi "$url/api/v1/models" `
-Method POST `
-Body $Body `
-Token $apiKey
$Parameters = @{
Uri = "$url/api/v1/models"
Method = 'post'
Body = $Body
Token = $apiKey
}
If ($PSCmdlet.ShouldProcess()) {
$result = Invoke-Method @Parameters
}
$result
}

View file

@ -15,7 +15,7 @@ Get-Users -url "https://assets.dip.co.uk" -token "token..."
Get-Users -url "https://assets.dip.co.uk" -token "token..." | Where-Object {$_.username -eq "stephenm" }
#>
function Get-Users()
function Get-User()
{
Param(
[parameter(mandatory=$true)]

Binary file not shown.

View file

@ -8,7 +8,11 @@ $manifestFile = "$moduleRoot\SnipeitPS.psd1"
$changelogFile = "$projectRoot\CHANGELOG.md"
$appveyorFile = "$projectRoot\appveyor.yml"
$publicFunctions = "$moduleRoot\Public"
<<<<<<< HEAD
$privateFunctions = "$moduleRoot\Private"
=======
$internalFunctions = "$moduleRoot\Private"
>>>>>>> 13ec3a62ac71275ec2bbe0bbf993130e9f53589f
Describe "SnipeitPS" {
Context "All required tests are present" {
@ -27,26 +31,22 @@ Describe "SnipeitPS" {
# These tests are...erm, borrowed...from the module tests from the Pester module.
# I think they are excellent for sanity checking, and all credit for the following
# tests goes to Dave Wyatt, the genius behind Pester. I've just adapted them
# slightly to match ConfluencePS.
# slightly to match SnipeitPS.
$script:manifest = $null
foreach ($line in (Get-Content $changelogFile))
{
if ($line -match "^\D*(?<Version>(\d+\.){1,3}\d+)")
{
foreach ($line in (Get-Content $changelogFile)) {
if ($line -match "^\D*(?<Version>(\d+\.){1,3}\d+)") {
$changelogVersion = $matches.Version
break
}
}
foreach ($line in (Get-Content $appveyorFile))
{
foreach ($line in (Get-Content $appveyorFile)) {
# (?<Version>()) - non-capturing group, but named Version. This makes it
# 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
break
}
@ -103,10 +103,6 @@ Describe "SnipeitPS" {
$appveyorVersion | Should Not BeNullOrEmpty
$appveyorVersion -as [Version] | Should Not BeNullOrEmpty
}
It "Appveyor version matches manifest version" {
$appveyorVersion -as [Version] | Should Be ( $script:manifest.ModuleVersion -as [Version] )
}
}
# The CI changes I'm testng now will render this section obsolete,
@ -134,6 +130,43 @@ Describe "SnipeitPS" {
# }
# }
# foreach ($f in $internalFiles) {
# It "Does not export $f" {
# $exportedFunctions -contains $f | Should Be $false
# }
# }
# }
It "Appveyor version matches manifest version" {
$appveyorVersion -as [Version] | Should Be ( $script:manifest.ModuleVersion -as [Version] )
}
}
# The CI changes I'm testng now will render this section obsolete,
# as it should automatically patch the module manifest file with all
# exported function names.
# Leaving the code here for the moment while I can ensure those
# features are working correctly.
#
# Context "Function checking" {
# $functionFiles = Get-ChildItem $publicFunctions -Filter *.ps1 |
# Select-Object -ExpandProperty BaseName |
# Where-Object { $_ -notlike "*.Tests" }
# $internalFiles = Get-ChildItem $internalFunctions -Filter *.ps1 |
# Select-Object -ExpandProperty BaseName |
# Where-Object { $_ -notlike "*.Tests" }
# #$exportedFunctions = $script:manifest.ExportedFunctions.Values.Name
# $exportedFunctions = $script:manifest.FunctionsToExport
# foreach ($f in $functionFiles) {
# It "Exports $f" {
# $exportedFunctions -contains $f | Should Be $true
# }
# }
# foreach ($f in $internalFiles) {
# It "Does not export $f" {
# $exportedFunctions -contains $f | Should Be $false
@ -153,55 +186,47 @@ Describe "SnipeitPS" {
It 'Source files contain no trailing whitespace' {
$badLines = @(
foreach ($file in $files)
{
foreach ($file in $files) {
$lines = [System.IO.File]::ReadAllLines($file.FullName)
$lineCount = $lines.Count
for ($i = 0; $i -lt $lineCount; $i++)
{
if ($lines[$i] -match '\s+$')
{
for ($i = 0; $i -lt $lineCount; $i++) {
if ($lines[$i] -match '\s+$') {
'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")"
}
}
}
It 'Source files all end with a newline' {
$badFiles = @(
foreach ($file in $files)
{
foreach ($file in $files) {
$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
}
}
)
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")"
}
}
}
Context 'PSScriptAnalyzer Rules' {
$analysis = Invoke-ScriptAnalyzer -Path "$moduleRoot" -Recurse -Settings "$projectRoot\PSScriptAnalyzerSettings.psd1"
$analysis = Invoke-ScriptAnalyzer -Path "$moduleRoot" -Recurse
$scriptAnalyzerRules = Get-ScriptAnalyzerRule
forEach ($rule in $scriptAnalyzerRules)
{
forEach ($rule in $scriptAnalyzerRules) {
It "Should pass $rule" {
If (($analysis) -and ($analysis.RuleName -contains $rule))
{
If (($analysis) -and ($analysis.RuleName -contains $rule)) {
$analysis |
Where RuleName -EQ $rule -OutVariable failures |
Out-Default

View file

@ -10,8 +10,9 @@
# This tells AppVeyor that we need WMF 5 and PowerShell 5.0
os: WMF 5
#environment:
# To encrypt a value in AppVeyor, go to the Account menu and choose "Encrypt data"
environment:
PSGalleryAPIKey:
secure: UdM6qhf5B0G8liHhUrwWERCZr44iSqmg4jUq0lwlTjZs4KyeoiwnBzdej0phqIAm
version: 1.0.{build}
@ -41,6 +42,7 @@ install:
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force | Out-Null
Install-Module InvokeBuild -Scope CurrentUser -Force
Install-Module BuildHelpers -Scope CurrentUser -Force
Install-Module platyPS -Scope CurrentUser -Force
Install-Module Pester -Scope CurrentUser -Force
Install-Module PSScriptAnalyzer -Scope CurrentUser -Force
$env:releasePath = "$($pwd.Path)\Release"
@ -57,3 +59,17 @@ build_script:
test_script:
- ps: Invoke-Build -Task Test
before_deploy:
- ps: Invoke-Build -Task Deploy
deploy:
provider: GitHub
release: v$(appveyor_build_version)
description: ''
auth_token:
secure: m72Ke3nJcSxZkc36UwRIw+q0NtNvERfQYHZUBNDvLP/kjW+mWmVueR6tmgBujyBM
draft: false
prerelease: false
on:
branch: master # release from master branch only
appveyor_repo_tag: false # deploy on tag push only

73
docs/Get-Asset.md Normal file
View file

@ -0,0 +1,73 @@
---
external help file: SnipeItPS-help.xml
Module Name: SnipeItPS
online version:
schema: 2.0.0
---
# Get-Asset
## SYNOPSIS
# Gets a list of Snipe-it Assets
## SYNTAX
```
Get-Asset [-url] <String> [-apiKey] <String>
```
## DESCRIPTION
{{Fill in the Description}}
## EXAMPLES
### -------------------------- EXAMPLE 1 --------------------------
```
Get-Asset -url "https://assets.dip.co.uk" -token "token..."
```
### -------------------------- EXAMPLE 2 --------------------------
```
Get-Asset -url "https://assets.dip.co.uk" -token "token..." | Where-Object {$_.name -eq "SUPPORT23" }
```
## PARAMETERS
### -url
URL of Snipeit system, can be set using Set-Info command
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
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: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
## INPUTS
## OUTPUTS
## NOTES
## RELATED LINKS

75
docs/Get-Category.md Normal file
View file

@ -0,0 +1,75 @@
---
external help file: SnipeItPS-help.xml
Module Name: SnipeItPS
online version:
schema: 2.0.0
---
# Get-Category
## SYNOPSIS
{{Fill in the Synopsis}}
## SYNTAX
```
Get-Category [-url] <String> [-apiKey] <String>
```
## DESCRIPTION
{{Fill in the Description}}
## EXAMPLES
### Example 1
```
PS C:\> {{ Add example code here }}
```
{{ Add example description here }}
## PARAMETERS
### -apiKey
{{Fill apiKey Description}}
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
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: 0
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
## INPUTS
### None
## OUTPUTS
### System.Object
## NOTES
## RELATED LINKS

75
docs/Get-Component.md Normal file
View file

@ -0,0 +1,75 @@
---
external help file: SnipeItPS-help.xml
Module Name: SnipeItPS
online version:
schema: 2.0.0
---
# Get-Component
## SYNOPSIS
{{Fill in the Synopsis}}
## SYNTAX
```
Get-Component [-url] <String> [-apiKey] <String>
```
## DESCRIPTION
{{Fill in the Description}}
## EXAMPLES
### Example 1
```
PS C:\> {{ Add example code here }}
```
{{ Add example description here }}
## PARAMETERS
### -apiKey
{{Fill apiKey Description}}
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
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: 0
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
## INPUTS
### None
## OUTPUTS
### System.Object
## NOTES
## RELATED LINKS

75
docs/Get-Manufacturer.md Normal file
View file

@ -0,0 +1,75 @@
---
external help file: SnipeItPS-help.xml
Module Name: SnipeItPS
online version:
schema: 2.0.0
---
# Get-Manufacturer
## SYNOPSIS
{{Fill in the Synopsis}}
## SYNTAX
```
Get-Manufacturer [-url] <String> [-apiKey] <String>
```
## DESCRIPTION
{{Fill in the Description}}
## EXAMPLES
### Example 1
```
PS C:\> {{ Add example code here }}
```
{{ Add example description here }}
## PARAMETERS
### -apiKey
{{Fill apiKey Description}}
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
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: 0
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
## INPUTS
### None
## OUTPUTS
### System.Object
## NOTES
## RELATED LINKS

75
docs/Get-Model.md Normal file
View file

@ -0,0 +1,75 @@
---
external help file: SnipeItPS-help.xml
Module Name: SnipeItPS
online version:
schema: 2.0.0
---
# Get-Model
## SYNOPSIS
{{Fill in the Synopsis}}
## SYNTAX
```
Get-Model [-url] <String> [-apiKey] <String>
```
## DESCRIPTION
{{Fill in the Description}}
## EXAMPLES
### Example 1
```
PS C:\> {{ Add example code here }}
```
{{ Add example description here }}
## PARAMETERS
### -apiKey
{{Fill apiKey Description}}
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
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: 0
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
## INPUTS
### None
## OUTPUTS
### System.Object
## NOTES
## RELATED LINKS

75
docs/Get-Status.md Normal file
View file

@ -0,0 +1,75 @@
---
external help file: SnipeItPS-help.xml
Module Name: SnipeItPS
online version:
schema: 2.0.0
---
# Get-Status
## SYNOPSIS
{{Fill in the Synopsis}}
## SYNTAX
```
Get-Status [-url] <String> [-apiKey] <String>
```
## DESCRIPTION
{{Fill in the Description}}
## EXAMPLES
### Example 1
```
PS C:\> {{ Add example code here }}
```
{{ Add example description here }}
## PARAMETERS
### -apiKey
{{Fill apiKey Description}}
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
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: 0
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
## INPUTS
### None
## OUTPUTS
### System.Object
## NOTES
## RELATED LINKS

73
docs/Get-User.md Normal file
View file

@ -0,0 +1,73 @@
---
external help file: SnipeItPS-help.xml
Module Name: SnipeItPS
online version:
schema: 2.0.0
---
# Get-User
## SYNOPSIS
# Gets a list of Snipe-it Users
## SYNTAX
```
Get-User [-url] <String> [-apiKey] <String>
```
## DESCRIPTION
{{Fill in the Description}}
## EXAMPLES
### -------------------------- EXAMPLE 1 --------------------------
```
Get-Users -url "https://assets.dip.co.uk" -token "token..."
```
### -------------------------- EXAMPLE 2 --------------------------
```
Get-Users -url "https://assets.dip.co.uk" -token "token..." | Where-Object {$_.username -eq "stephenm" }
```
## PARAMETERS
### -url
URL of Snipeit system, can be set using Set-Info command
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
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: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
## INPUTS
## OUTPUTS
## NOTES
## RELATED LINKS

167
docs/New-Asset.md Normal file
View file

@ -0,0 +1,167 @@
---
external help file: SnipeItPS-help.xml
Module Name: SnipeItPS
online version:
schema: 2.0.0
---
# New-Asset
## SYNOPSIS
{{Fill in the Synopsis}}
## SYNTAX
```
New-Asset [-Name] <String> [-Status_id] <String> [-Model_id] <String> [-url] <String> [-apiKey] <String>
[[-customfields] <Hashtable>] [-WhatIf] [-Confirm]
```
## DESCRIPTION
{{Fill in the Description}}
## EXAMPLES
### Example 1
```
PS C:\> {{ Add example code here }}
```
{{ Add example description here }}
## 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
```
### -Model_id
{{Fill Model_id Description}}
```yaml
Type: String
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
```
### -Status_id
{{Fill Status_id Description}}
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -WhatIf
Shows what would happen if the cmdlet runs.
The cmdlet is not run.
```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -apiKey
{{Fill apiKey Description}}
```yaml
Type: String
Parameter Sets: (All)
Aliases:
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
Position: 5
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
Accept pipeline input: False
Accept wildcard characters: False
```
## INPUTS
### None
## OUTPUTS
### System.Object
## NOTES
## RELATED LINKS

152
docs/New-Component.md Normal file
View file

@ -0,0 +1,152 @@
---
external help file: SnipeItPS-help.xml
Module Name: SnipeItPS
online version:
schema: 2.0.0
---
# New-Component
## SYNOPSIS
{{Fill in the Synopsis}}
## SYNTAX
```
New-Component [-name] <String> [-category_id] <String> [-qty] <String> [-url] <String> [-apiKey] <String>
[-WhatIf] [-Confirm]
```
## DESCRIPTION
{{Fill in the Description}}
## EXAMPLES
### Example 1
```
PS C:\> {{ Add example code here }}
```
{{ Add example description here }}
## 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
```
### -WhatIf
Shows what would happen if the cmdlet runs.
The cmdlet is not run.
```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -apiKey
{{Fill apiKey Description}}
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 4
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
Accept pipeline input: False
Accept wildcard characters: False
```
## INPUTS
### None
## OUTPUTS
### System.Object
## NOTES
## RELATED LINKS

121
docs/New-Manufacturer.md Normal file
View file

@ -0,0 +1,121 @@
---
external help file: SnipeItPS-help.xml
Module Name: SnipeItPS
online version:
schema: 2.0.0
---
# New-Manufacturer
## SYNOPSIS
{{Fill in the Synopsis}}
## SYNTAX
```
New-Manufacturer [-Name] <String> [-url] <String> [-apiKey] <String> [-WhatIf] [-Confirm]
```
## DESCRIPTION
{{Fill in the Description}}
## EXAMPLES
### Example 1
```
PS C:\> {{ Add example code here }}
```
{{ Add example description here }}
## 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
{{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
```
### -WhatIf
Shows what would happen if the cmdlet runs.
The cmdlet is not run.
```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -apiKey
{{Fill apiKey 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: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
## INPUTS
### None
## OUTPUTS
### System.Object
## NOTES
## RELATED LINKS

167
docs/New-Model.md Normal file
View file

@ -0,0 +1,167 @@
---
external help file: SnipeItPS-help.xml
Module Name: SnipeItPS
online version:
schema: 2.0.0
---
# New-Model
## SYNOPSIS
{{Fill in the Synopsis}}
## SYNTAX
```
New-Model [-name] <String> [-category_id] <Int32> [-manufacturer_id] <Int32> [-fieldset_id] <Int32>
[-url] <String> [-apiKey] <String> [-WhatIf] [-Confirm]
```
## DESCRIPTION
{{Fill in the Description}}
## EXAMPLES
### Example 1
```
PS C:\> {{ Add example code here }}
```
{{ Add example description here }}
## 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
```
### -WhatIf
Shows what would happen if the cmdlet runs.
The cmdlet is not run.
```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -apiKey
{{Fill apiKey Description}}
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 5
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
Accept pipeline input: False
Accept wildcard characters: False
```
## INPUTS
### None
## OUTPUTS
### System.Object
## NOTES
## RELATED LINKS

182
docs/Set-Asset.md Normal file
View file

@ -0,0 +1,182 @@
---
external help file: SnipeItPS-help.xml
Module Name: SnipeItPS
online version:
schema: 2.0.0
---
# Set-Asset
## SYNOPSIS
{{Fill in the Synopsis}}
## SYNTAX
```
Set-Asset [-id] <Int32> [-Name] <String> [-Status_id] <String> [-Model_id] <String> [-url] <String>
[-apiKey] <String> [[-customfields] <Hashtable>] [-WhatIf] [-Confirm]
```
## DESCRIPTION
{{Fill in the Description}}
## EXAMPLES
### Example 1
```
PS C:\> {{ Add example code here }}
```
{{ Add example description here }}
## 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
```
### -Model_id
{{Fill Model_id Description}}
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 3
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: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -Status_id
{{Fill Status_id Description}}
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -WhatIf
Shows what would happen if the cmdlet runs.
The cmdlet is not run.
```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -apiKey
{{Fill apiKey Description}}
```yaml
Type: String
Parameter Sets: (All)
Aliases:
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
Position: 6
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
Accept pipeline input: False
Accept wildcard characters: False
```
## INPUTS
### None
## OUTPUTS
### System.Object
## NOTES
## RELATED LINKS

136
docs/Set-AssetOwner.md Normal file
View file

@ -0,0 +1,136 @@
---
external help file: SnipeItPS-help.xml
Module Name: SnipeItPS
online version:
schema: 2.0.0
---
# Set-AssetOwner
## SYNOPSIS
{{Fill in the Synopsis}}
## SYNTAX
```
Set-AssetOwner [-id] <Int32> [-user_id] <Int32> [-url] <String> [-apiKey] <String> [-WhatIf] [-Confirm]
```
## DESCRIPTION
{{Fill in the Description}}
## EXAMPLES
### Example 1
```
PS C:\> {{ Add example code here }}
```
{{ Add example description here }}
## 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
```
### -WhatIf
Shows what would happen if the cmdlet runs.
The cmdlet is not run.
```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -apiKey
{{Fill apiKey Description}}
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 3
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: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -user_id
{{Fill user_id Description}}
```yaml
Type: Int32
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
## INPUTS
### None
## OUTPUTS
### System.Object
## NOTES
## RELATED LINKS

136
docs/Set-Component.md Normal file
View file

@ -0,0 +1,136 @@
---
external help file: SnipeItPS-help.xml
Module Name: SnipeItPS
online version:
schema: 2.0.0
---
# Set-Component
## SYNOPSIS
{{Fill in the Synopsis}}
## SYNTAX
```
Set-Component [-id] <String> [-qty] <String> [-url] <String> [-apiKey] <String> [-WhatIf] [-Confirm]
```
## DESCRIPTION
{{Fill in the Description}}
## EXAMPLES
### Example 1
```
PS C:\> {{ Add example code here }}
```
{{ Add example description here }}
## 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
```
### -WhatIf
Shows what would happen if the cmdlet runs.
The cmdlet is not run.
```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -apiKey
{{Fill apiKey Description}}
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -id
{{Fill id 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: 1
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: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
## INPUTS
### None
## OUTPUTS
### System.Object
## NOTES
## RELATED LINKS

75
docs/Set-Info.md Normal file
View file

@ -0,0 +1,75 @@
---
external help file: SnipeItPS-help.xml
Module Name: SnipeItPS
online version:
schema: 2.0.0
---
# Set-Info
## SYNOPSIS
{{Fill in the Synopsis}}
## SYNTAX
```
Set-Info [[-url] <Uri>] [[-apiKey] <String>]
```
## DESCRIPTION
{{Fill in the Description}}
## EXAMPLES
### Example 1
```
PS C:\> {{ Add example code here }}
```
{{ Add example description here }}
## PARAMETERS
### -apiKey
{{Fill apiKey Description}}
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -url
{{Fill url Description}}
```yaml
Type: Uri
Parameter Sets: (All)
Aliases:
Required: False
Position: 0
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
## INPUTS
### None
## OUTPUTS
### System.Object
## NOTES
## RELATED LINKS