├── .github └── ISSUE_TEMPLATE.md ├── .gitlab-ci.yml ├── .vscode ├── launch.json ├── settings.json └── tasks.json ├── CHANGELOG.md ├── LICENSE ├── PSScriptAnalyzerSettings.psd1 ├── README.md ├── SnipeitPS.build.ps1 ├── SnipeitPS ├── Private │ ├── ConvertTo-GetParameter.ps1 │ ├── Get-ParameterValue.ps1 │ ├── Get-SnipeitAlias.ps1 │ ├── Invoke-SnipeitMethod.ps1 │ ├── Reset-SnipeitPSLegacyApi.ps1 │ ├── Set-SnipeitAlias.ps1 │ ├── Set-SnipeitPSLegacyApiKey.ps1 │ ├── Set-SnipeitPSLegacyUrl.ps1 │ ├── Test-SnipeitAlias.ps1 │ └── Test-SnipeitPSConnection.ps1 ├── Public │ ├── Connect-SnipeitPS.ps1 │ ├── Get-SnipeitAccessory.ps1 │ ├── Get-SnipeitAccessoryOwner.ps1 │ ├── Get-SnipeitActivity.ps1 │ ├── Get-SnipeitAsset.ps1 │ ├── Get-SnipeitAssetMaintenance.ps1 │ ├── Get-SnipeitCategory.ps1 │ ├── Get-SnipeitCompany.ps1 │ ├── Get-SnipeitComponent.ps1 │ ├── Get-SnipeitConsumable.ps1 │ ├── Get-SnipeitCustomField.ps1 │ ├── Get-SnipeitDepartment.ps1 │ ├── Get-SnipeitFieldset.ps1 │ ├── Get-SnipeitLicense.ps1 │ ├── Get-SnipeitLicenseSeat.ps1 │ ├── Get-SnipeitLocation.ps1 │ ├── Get-SnipeitManufacturer.ps1 │ ├── Get-SnipeitModel.ps1 │ ├── Get-SnipeitStatus.ps1 │ ├── Get-SnipeitSupplier.ps1 │ ├── Get-SnipeitUser.ps1 │ ├── New-SnipeitAccessory.ps1 │ ├── New-SnipeitAsset.ps1 │ ├── New-SnipeitAssetMaintenance.ps1 │ ├── New-SnipeitAudit.ps1 │ ├── New-SnipeitCategory.ps1 │ ├── New-SnipeitCompany.ps1 │ ├── New-SnipeitComponent.ps1 │ ├── New-SnipeitConsumable.ps1 │ ├── New-SnipeitCustomField.ps1 │ ├── New-SnipeitDepartment.ps1 │ ├── New-SnipeitLicense.ps1 │ ├── New-SnipeitLocation.ps1 │ ├── New-SnipeitManufacturer.ps1 │ ├── New-SnipeitModel.ps1 │ ├── New-SnipeitSupplier.ps1 │ ├── New-SnipeitUser.ps1 │ ├── Remove-SnipeitAccessory.ps1 │ ├── Remove-SnipeitAsset.ps1 │ ├── Remove-SnipeitAssetMaintenance.ps1 │ ├── Remove-SnipeitCategory.ps1 │ ├── Remove-SnipeitCompany.ps1 │ ├── Remove-SnipeitComponent.ps1 │ ├── Remove-SnipeitConsumable.ps1 │ ├── Remove-SnipeitCustomField.ps1 │ ├── Remove-SnipeitDepartment.ps1 │ ├── Remove-SnipeitLicense.ps1 │ ├── Remove-SnipeitLocation.ps1 │ ├── Remove-SnipeitManufacturer.ps1 │ ├── Remove-SnipeitModel.ps1 │ ├── Remove-SnipeitSupplier.ps1 │ ├── Remove-SnipeitUser.ps1 │ ├── Reset-SnipeitAccessoryOwner.ps1 │ ├── Reset-SnipeitAssetOwner.ps1 │ ├── Set-SnipeitAccessory.ps1 │ ├── Set-SnipeitAccessoryOwner.ps1 │ ├── Set-SnipeitAsset.ps1 │ ├── Set-SnipeitAssetOwner.ps1 │ ├── Set-SnipeitCategory.ps1 │ ├── Set-SnipeitCompany.ps1 │ ├── Set-SnipeitComponent.ps1 │ ├── Set-SnipeitConsumable.ps1 │ ├── Set-SnipeitCustomField.ps1 │ ├── Set-SnipeitDepartment.ps1 │ ├── Set-SnipeitInfo.ps1 │ ├── Set-SnipeitLicense.ps1 │ ├── Set-SnipeitLicenseSeat.ps1 │ ├── Set-SnipeitLocation.ps1 │ ├── Set-SnipeitManufacturer.ps1 │ ├── Set-SnipeitModel.ps1 │ ├── Set-SnipeitStatus.ps1 │ ├── Set-SnipeitSupplier.ps1 │ ├── Set-SnipeitUser.ps1 │ └── Update-SnipeitAlias.ps1 ├── SnipeitPS.psd1 └── SnipeitPS.psm1 ├── Tests └── SnipeitPS.Tests.ps1 ├── _config.yml ├── appveyor.yml ├── build.ps1 └── docs ├── Connect-SnipeitPS.md ├── Get-SnipeitAccessory.md ├── Get-SnipeitAccessoryOwner.md ├── Get-SnipeitActivity.md ├── Get-SnipeitAsset.md ├── Get-SnipeitAssetMaintenance.md ├── Get-SnipeitCategory.md ├── Get-SnipeitCompany.md ├── Get-SnipeitComponent.md ├── Get-SnipeitConsumable.md ├── Get-SnipeitCustomField.md ├── Get-SnipeitDepartment.md ├── Get-SnipeitFieldset.md ├── Get-SnipeitLicense.md ├── Get-SnipeitLicenseSeat.md ├── Get-SnipeitLocation.md ├── Get-SnipeitManufacturer.md ├── Get-SnipeitModel.md ├── Get-SnipeitStatus.md ├── Get-SnipeitSupplier.md ├── Get-SnipeitUser.md ├── New-SnipeitAccessory.md ├── New-SnipeitAsset.md ├── New-SnipeitAssetMaintenance.md ├── New-SnipeitAudit.md ├── New-SnipeitCategory.md ├── New-SnipeitCompany.md ├── New-SnipeitComponent.md ├── New-SnipeitConsumable.md ├── New-SnipeitCustomField.md ├── New-SnipeitDepartment.md ├── New-SnipeitLicense.md ├── New-SnipeitLocation.md ├── New-SnipeitManufacturer.md ├── New-SnipeitModel.md ├── New-SnipeitSupplier.md ├── New-SnipeitUser.md ├── Remove-SnipeitAccessory.md ├── Remove-SnipeitAsset.md ├── Remove-SnipeitAssetMaintenance.md ├── Remove-SnipeitCategory.md ├── Remove-SnipeitCompany.md ├── Remove-SnipeitComponent.md ├── Remove-SnipeitConsumable.md ├── Remove-SnipeitCustomField.md ├── Remove-SnipeitDepartment.md ├── Remove-SnipeitLicense.md ├── Remove-SnipeitLocation.md ├── Remove-SnipeitManufacturer.md ├── Remove-SnipeitModel.md ├── Remove-SnipeitSupplier.md ├── Remove-SnipeitUser.md ├── Reset-SnipeitAccessoryOwner.md ├── Reset-SnipeitAssetOwner.md ├── Set-SnipeitAccessory.md ├── Set-SnipeitAccessoryOwner.md ├── Set-SnipeitAsset.md ├── Set-SnipeitAssetOwner.md ├── Set-SnipeitCategory.md ├── Set-SnipeitCompany.md ├── Set-SnipeitComponent.md ├── Set-SnipeitConsumable.md ├── Set-SnipeitCustomField.md ├── Set-SnipeitDepartment.md ├── Set-SnipeitInfo.md ├── Set-SnipeitLicense.md ├── Set-SnipeitLicenseSeat.md ├── Set-SnipeitLocation.md ├── Set-SnipeitManufacturer.md ├── Set-SnipeitModel.md ├── Set-SnipeitStatus.md ├── Set-SnipeitSupplier.md ├── Set-SnipeitUser.md ├── SnipeitPS.md ├── Update-SnipeitAlias.md ├── _config.yml └── about_SnipeitPS.md /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## Context 2 | 3 | 4 | 5 | ## Your Environment 6 | 7 | * SnipitPS Module version used: 8 | * Operating System and PowerShell version: 9 | * Snipe It version: 10 | 11 | ## Expected Behavior 12 | 13 | 14 | 15 | ## Current Behavior 16 | 17 | 18 | 19 | ## Possible Solution 20 | 21 | 22 | 23 | ## Steps to Reproduce (for bugs) 24 | 25 | 26 | 1. 27 | 2. 28 | 3. 29 | 4. 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /.gitlab-ci.yml: -------------------------------------------------------------------------------- 1 | stages: 2 | - test 3 | - release 4 | variables: 5 | GIT_SSL_NO_VERIFY: "true" 6 | ErrorActionPreference: STOP 7 | Test: 8 | stage: test 9 | script: 10 | - .\build.ps1 -Tasks 'test' 11 | except: 12 | - master 13 | Release: 14 | stage: release 15 | script: 16 | - .\build.ps1 -Tasks 'test','release' 17 | only: 18 | - master 19 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [{ 4 | "type": "PowerShell", 5 | "request": "launch", 6 | "name": "PowerShell Pester Tests", 7 | "script": "Invoke-Pester", 8 | "args": [], 9 | "cwd": "${workspaceRoot}" 10 | }, 11 | { 12 | "type": "PowerShell", 13 | "request": "launch", 14 | "name": "PowerShell Launch (current file)", 15 | "script": "${file}", 16 | "args": [], 17 | "cwd": "${file}" 18 | }, 19 | { 20 | "type": "PowerShell", 21 | "request": "attach", 22 | "name": "PowerShell Attach to Host Process", 23 | "processId": "${command.PickPSHostProcess}", 24 | "runspaceId": 1 25 | }, 26 | { 27 | "type": "PowerShell", 28 | "request": "launch", 29 | "name": "PowerShell Interactive Session", 30 | "cwd": "${workspaceRoot}" 31 | } 32 | ] 33 | } 34 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | // Place your settings in this file to overwrite default and user settings. 2 | { 3 | "files.encoding": "utf8", 4 | "files.eol": "\r\n", 5 | "files.trimTrailingWhitespace": true, 6 | "files.insertFinalNewline": true, 7 | "editor.tabSize": 4, 8 | "[markdown]": { 9 | "editor.wordwrap": "on", 10 | "editor.renderWhitespace": "all", 11 | "editor.acceptSuggestionOnEnter": false, 12 | "editor.rulers": [80], 13 | "editor.trimAutoWhitespace": false 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | // Available variables which can be used inside of strings. 2 | // ${workspaceRoot}: the root folder of the team 3 | // ${file}: the current opened file 4 | // ${relativeFile}: the current opened file relative to workspaceRoot 5 | // ${fileBasename}: the current opened file's basename 6 | // ${fileDirname}: the current opened file's dirname 7 | // ${fileExtname}: the current opened file's extension 8 | // ${cwd}: the current working directory of the spawned process 9 | { 10 | // See https://go.microsoft.com/fwlink/?LinkId=733558 11 | // for the documentation about the tasks.json format 12 | "version": "2.0.0", 13 | // Start PowerShell 14 | "windows": { 15 | "command": "${env:windir}\\sysnative\\windowspowershell\\v1.0\\PowerShell.exe", 16 | "args": [ 17 | "-NoProfile", 18 | "-ExecutionPolicy", 19 | "Bypass" 20 | ] 21 | }, 22 | "linux": { 23 | "command": "/usr/bin/powershell", 24 | "args": [ 25 | "-NoProfile" 26 | ] 27 | }, 28 | "osx": { 29 | "command": "/usr/local/bin/powershell", 30 | "args": [ 31 | "-NoProfile" 32 | ] 33 | }, 34 | // Show the output window always 35 | "showOutput": "always", 36 | // Associate with test task runner 37 | "tasks": [{ 38 | "label": "Build Help", 39 | "args": [ 40 | "Write-Host 'Invoking platyPS'; New-ExternalHelp -Path .\\docs\\en-US -OutputPath .\\SnipeitPS\\en-US -Force;", 41 | "Invoke-Command { Write-Host 'Completed Build task in task runner.' }" 42 | ] 43 | }, 44 | { 45 | "label": "Test", 46 | "suppressTaskName": true, 47 | "isTestCommand": true, 48 | "args": [ 49 | "Write-Host 'Invoking Pester'; Invoke-Pester -PesterOption @{IncludeVSCodeMarker=$true};", 50 | "Invoke-Command { Write-Host 'Completed Test task in task runner.' }" 51 | ], 52 | "problemMatcher": "$pester" 53 | } 54 | ] 55 | } 56 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Brian Bunke 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /PSScriptAnalyzerSettings.psd1: -------------------------------------------------------------------------------- 1 | @{ 2 | Severity=@('Error','Warning') 3 | # IncludeRules = @() 4 | ExcludeRules = @( 5 | 'PSAvoidUsingUserNameAndPassWordParams', 6 | 'PSAvoidUsingPlainTextForPassword' 7 | ) 8 | } 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![GitHub release](https://img.shields.io/github/release/snazy2000/SnipeitPS.svg)](https://github.com/snazy2000/snipeitps/releases/latest) [![Build status](https://ci.appveyor.com/api/projects/status/dvuw4ggx543nx3h7/branch/master?svg=true)](https://ci.appveyor.com/project/snazy2000/snipeitps/branch/master) [![PowerShell Gallery](https://img.shields.io/powershellgallery/dt/snipeitps.svg)](https://www.powershellgallery.com/packages/snipeitps) ![License](https://img.shields.io/badge/license-MIT-blue.svg) 2 | 3 | --- 4 | 5 | ## Want to say thanks? 6 | 7 | [![paypal](https://www.paypalobjects.com/en_US/GB/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=XP29MAD7P3WDN&source=url) 8 | 9 | ## Instructions 10 | 11 | ### Installation 12 | 13 | Install SnipeitPS from the PowerShell Gallery `Install-Module` requires PowerShellGet (included in PS v5, or download for v3/v4 via the gallery link) 14 | 15 | ```powershell 16 | # One time only install: (requires an admin PowerShell window) 17 | Install-Module SnipeitPS 18 | 19 | # Check for updates occasionally: 20 | Update-Module SnipeitPS 21 | 22 | # import module to session: 23 | Import-Module SnipeitPS 24 | 25 | # Set connection 26 | Connect-SnipeitPS -URL 'https://asset.example.com' -apiKey 'tokenKey' 27 | 28 | # Or set connection with safely saved credentials, first save credentials 29 | $SnipeCred =Get-Credential -message "Use url as username and apikey as password" 30 | $SnipeCred | Export-CliXml snipecred.xml 31 | 32 | # ..then use your saved credentials like 33 | Connect-SnipeitPS -siteCred (Import-CliXml snipecred.xml) 34 | 35 | # OR use -secureApiKey that allow pass apiKey as SecureString 36 | # if you are usin Microsoft.PowerShell.SecretManagement or like 37 | Connect-SnipeitPS -URL 'https://asset.example.com' -secureApiKey 'tokenKey' 38 | 39 | ``` 40 | 41 | ### Usage 42 | 43 | ```powershell 44 | # Review the help at any time! 45 | Get-Help about_SnipeitPS 46 | Get-Command -Module SnipeitPS 47 | Get-Help Get-SnipeitAsset -Full # or any other command 48 | ``` 49 | ### Reporting bugs and issues 50 | Please use -Verbose switch with command you have problem with. 51 | Then create ticket here with all -Verbose output 52 | -------------------------------------------------------------------------------- /SnipeitPS/Private/ConvertTo-GetParameter.ps1: -------------------------------------------------------------------------------- 1 | function ConvertTo-GetParameter { 2 | 3 | <# 4 | .SYNOPSIS 5 | Generate the GET parameter string for an URL from a hashtable 6 | #> 7 | [CmdletBinding()] 8 | param ( 9 | [Parameter( Position = 0, Mandatory = $true, ValueFromPipeline = $true )] 10 | [hashtable]$InputObject 11 | ) 12 | 13 | BEGIN { 14 | [string]$parameters = "?" 15 | } 16 | 17 | PROCESS { 18 | Add-Type -AssemblyName System.Web 19 | 20 | Write-Verbose "[$($MyInvocation.MyCommand.Name)] Making HTTP get parameter string out of a hashtable" 21 | foreach ($key in $InputObject.Keys) { 22 | $parameters += "$key=$([System.Web.HttpUtility]::UrlEncode($InputObject[$key]))&" 23 | } 24 | } 25 | 26 | END { 27 | $parameters -replace ".$" 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /SnipeitPS/Private/Get-ParameterValue.ps1: -------------------------------------------------------------------------------- 1 | function Get-ParameterValue { 2 | #.Synopsis 3 | # Get the actual values of parameters which have manually set (non-null) default values or values passed in the call 4 | #.Description 5 | # Unlike $PSBoundParameters, the hashtable returned from Get-ParameterValues includes non-empty default parameter values. 6 | # NOTE: Default values that are the same as the implied values are ignored (e.g.: empty strings, zero numbers, nulls). 7 | #.Example 8 | # function Test-Parameters { 9 | # [CmdletBinding()] 10 | # param( 11 | # $Name = $Env:UserName, 12 | # $Age 13 | # ) 14 | # $Parameters = . Get-ParameterValues 15 | # 16 | # # This WILL ALWAYS have a value... 17 | # Write-Host $Parameters["Name"] 18 | # 19 | # # But this will NOT always have a value... 20 | # Write-Host $PSBoundParameters["Name"] 21 | # } 22 | [CmdletBinding()] 23 | param( 24 | # Pass $MyInvocation.MyCommand.Parameters to function, powershell 7 seems to only populate variables with dot sourcing 25 | [parameter(mandatory = $true)] 26 | $Parameters 27 | , 28 | [parameter(mandatory = $true)] 29 | $BoundParameters, 30 | 31 | [string[]]$DefaultExcludeParameter = @("id", "url", "apiKey", 'Debug', 'Verbose','RequestType','customfields') 32 | ) 33 | 34 | if ($MyInvocation.Line[($MyInvocation.OffsetInLine - 1)] -ne '.') { 35 | throw "Get-ParameterValue must be dot-sourced, like this: . Get-ParameterValues" 36 | } 37 | 38 | 39 | $ParameterValues = @{} 40 | foreach ($parameter in $Parameters.GetEnumerator()) { 41 | # gm -in $parameter.Value | Out-Default 42 | try { 43 | $key = $parameter.Key 44 | if ($key -notin $DefaultExcludeParameter) { 45 | #Fill in default parameters values 46 | if ($null -ne ($value = Get-Variable -Name $key -ValueOnly -ErrorAction Ignore )) { 47 | if ($value -ne ($null -as $parameter.Value.ParameterType)) { 48 | $ParameterValues[$key] = $value 49 | } 50 | } 51 | #Fill in all given parameters even empty 52 | if ($BoundParameters.ContainsKey($key)) { 53 | $ParameterValues[$key] = $BoundParameters[$key] 54 | } 55 | 56 | } 57 | } 58 | finally {} 59 | } 60 | 61 | #Convert switch parameters to booleans so it converts nicely to json 62 | foreach ( $key in @($ParameterValues.Keys)) { 63 | if ($true -eq $ParameterValues[$key].IsPresent){ 64 | $ParameterValues[$key]=$true; 65 | } 66 | } 67 | 68 | return $ParameterValues 69 | } 70 | -------------------------------------------------------------------------------- /SnipeitPS/Private/Get-SnipeitAlias.ps1: -------------------------------------------------------------------------------- 1 | Function Get-SnipeitAlias(){ 2 | @{'Get-Asset' = 'Get-SnipeitAsset'; 3 | 'Get-AssetMaintenance' = 'Get-SnipeitAssetMaintenance'; 4 | 'Get-Category' = 'Get-SnipeitCategory'; 5 | 'Get-Company' = 'Get-SnipeitCompany'; 6 | 'Get-Component' = 'Get-SnipeitCompany'; 7 | 'Get-CustomField' = 'Get-SnipeitCustomField'; 8 | 'Get-Department' = 'Get-SnipeitDepartment'; 9 | 'Get-Fieldset' = 'Get-SnipeitFieldset'; 10 | 'Get-Manufacturer' = 'Get-SnipeitManufacturer'; 11 | 'Get-Model' = 'Get-SnipeitModel'; 12 | 'Get-Status' = 'Get-SnipeitStatus'; 13 | 'Get-Supplier' = 'Get-SnipeitSupplier'; 14 | 'Get-User' = 'Get-SnipeitUser'; 15 | 'New-Asset' = 'New-SnipeitAsset'; 16 | 'New-AssetMaintenance' = 'New-SnipeitAssetMaintenance'; 17 | 'New-Category' = 'New-SnipeitCategory'; 18 | 'New-Component' = 'New-SnipeitComponent'; 19 | 'New-CustomField' = 'New-SnipeitCustomField'; 20 | 'New-Department' = 'New-SnipeitDepartment'; 21 | 'New-License' = 'New-SnipeitLicense'; 22 | 'Set-License' = 'Set-SnipeitLicense'; 23 | 'New-Location' = 'New-SnipeitLocation'; 24 | 'New-Manufacturer' = 'New-SnipeitManufacturer'; 25 | 'New-Model' = 'New-SnipeitModel'; 26 | 'New-User' = 'New-SnipeitUser'; 27 | 'Set-Asset' = 'Set-SnipeitAsset'; 28 | 'Set-AssetOwner' = 'Set-SnipeitAssetOwner'; 29 | 'Set-Component' = 'Set-SnipeitComponent'; 30 | 'Set-Model' = 'Set-SnipeitModel'; 31 | 'Set-Info' = 'Set-SnipeitInfo'; 32 | 'Set-User' = 'Set-SnipeitUser'; 33 | 'New-Accessory' = 'New-SnipeitAccessory'; 34 | 'Set-Accessory' = 'Set-SnipeitAccessory'; 35 | 'Get-Accessory' = 'Get-SnipeitAccessory'; 36 | 'Remove-Asset' = 'Remove-SnipeitAsset'; 37 | 'Remove-User' = 'Remove-SnipeitUser';} 38 | } 39 | -------------------------------------------------------------------------------- /SnipeitPS/Private/Reset-SnipeitPSLegacyApi.ps1: -------------------------------------------------------------------------------- 1 | function Reset-SnipeitPSLegacyApi { 2 | [CmdletBinding( 3 | SupportsShouldProcess = $true, 4 | ConfirmImpact = "Low" 5 | )] 6 | param( 7 | ) 8 | process { 9 | Write-Verbose 'Reset-SnipeitPSLegacyApi' 10 | if ($PSCmdlet.ShouldProcess("ShouldProcess?")) { 11 | $SnipeitPSSession.legacyUrl = $null 12 | $SnipeitPSSession.legacyApiKey = $null 13 | 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /SnipeitPS/Private/Set-SnipeitAlias.ps1: -------------------------------------------------------------------------------- 1 | function Set-SnipeitAlias() 2 | { 3 | [CmdletBinding( 4 | SupportsShouldProcess = $true, 5 | ConfirmImpact = "Low" 6 | )] 7 | param() 8 | Write-Verbose "Setting compatibility aliases.. " 9 | Write-Verbose "All aliases are deprediated." 10 | $SnipeitAliases = get-SnipeitAlias 11 | ForEach ($key in $SnipeitAliases.Keys ) { 12 | New-Alias -Name $key -Value $($SnipeitAliases[$key]) -Scope 1 13 | Write-Verbose ("{0,5} -> {1}" -f $key,$($SnipeitAliases[$key])) 14 | } 15 | Write-Verbose "Please start using native 'Snipeit' prfixed functions instead." 16 | Get-Command -Module SnipeitPS -CommandType Alias | Select-Object -Property DisplayName,ResolvedCommand 17 | 18 | } 19 | -------------------------------------------------------------------------------- /SnipeitPS/Private/Set-SnipeitPSLegacyApiKey.ps1: -------------------------------------------------------------------------------- 1 | function Set-SnipeitPSLegacyApiKey { 2 | [CmdletBinding( 3 | SupportsShouldProcess = $true, 4 | ConfirmImpact = "Low" 5 | )] 6 | param( 7 | [string]$apiKey 8 | ) 9 | process { 10 | if ($PSCmdlet.ShouldProcess("ShouldProcess?")) { 11 | if($PSVersionTable.PSVersion -ge '7.0'){ 12 | $SnipeitPSSession.legacyApiKey = ConvertTo-SecureString -AsPlainText -String $apiKey 13 | } else { 14 | $SnipeitPSSession.legacyApiKey = ConvertTo-SecureString -Force -AsPlainText -String $apiKey 15 | } 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /SnipeitPS/Private/Set-SnipeitPSLegacyUrl.ps1: -------------------------------------------------------------------------------- 1 | function Set-SnipeitPSLegacyUrl { 2 | [CmdletBinding( 3 | SupportsShouldProcess = $true, 4 | ConfirmImpact = "Low" 5 | )] 6 | param( 7 | $url 8 | ) 9 | process { 10 | if ($PSCmdlet.ShouldProcess("ShouldProcess?")) { 11 | $SnipeitPSSession.legacyUrl = $url.TrimEnd('/') 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /SnipeitPS/Private/Test-SnipeitAlias.ps1: -------------------------------------------------------------------------------- 1 | function Test-SnipeitAlias() 2 | { 3 | [CmdletBinding()] 4 | param( 5 | [parameter(mandatory = $true)] 6 | [string]$invocationName, 7 | [parameter(mandatory = $true)] 8 | [string]$commandName 9 | ) 10 | if($invocationName -ne $commandName) { 11 | Write-Warning "$invocationName is still working, but it has been superceded by $commandName, please use it instead." 12 | Write-Warning 'To update your scripts you can use Update-SnipeitAlias helper function: ' 13 | Write-Warning '"Get-Content [your-script.ps1] | Update-SnipeitAlias | Out-File [new-script-name.ps1]"' 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /SnipeitPS/Private/Test-SnipeitPSConnection.ps1: -------------------------------------------------------------------------------- 1 | function Test-SnipeitPSConnection { 2 | #test api connection 3 | $Parameters = @{ 4 | Api = '/api/v1/statuslabels' 5 | Method = 'Get' 6 | GetParameters = @{'limit'=1} 7 | } 8 | Write-Verbose "Testing connection to $($SnipeitPSSession.url)." 9 | 10 | $contest = Invoke-SnipeitMethod @Parameters 11 | 12 | if ( $contest) { 13 | Write-Verbose "Connection to $($SnipeitPSSession.url) tested succesfully." 14 | return $true 15 | } else { 16 | return $false 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /SnipeitPS/Public/Get-SnipeitAccessoryOwner.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Get list of checked out accessories 4 | .DESCRIPTION 5 | Get list of checked out accessories 6 | 7 | .PARAMETER id 8 | Unique ID For accessory to list 9 | 10 | .PARAMETER url 11 | Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system. 12 | 13 | .PARAMETER apiKey 14 | Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit. 15 | 16 | .EXAMPLE 17 | Get-SnipeitAccessoryOwner -id 1 18 | #> 19 | function Get-SnipeitAccessoryOwner() { 20 | [CmdletBinding( 21 | SupportsShouldProcess = $true, 22 | ConfirmImpact = "Medium" 23 | )] 24 | 25 | Param( 26 | [parameter(mandatory = $true)] 27 | [int]$id, 28 | 29 | [parameter(mandatory = $false)] 30 | [string]$url, 31 | 32 | [parameter(mandatory = $false)] 33 | [string]$apiKey 34 | ) 35 | begin { 36 | $Parameters = @{ 37 | Api = "/api/v1/accessories/$id/checkedout" 38 | Method = 'GET' 39 | } 40 | 41 | if ($PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 42 | Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead." 43 | Set-SnipeitPSLegacyApiKey -apiKey $apikey 44 | } 45 | 46 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url) { 47 | Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." 48 | Set-SnipeitPSLegacyUrl -url $url 49 | } 50 | } 51 | process { 52 | if ($PSCmdlet.ShouldProcess("ShouldProcess?")) { 53 | $result = Invoke-SnipeitMethod @Parameters 54 | } 55 | $result 56 | } 57 | 58 | end { 59 | # reset legacy sessions 60 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url -or $PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 61 | Reset-SnipeitPSLegacyApi 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /SnipeitPS/Public/Get-SnipeitAssetMaintenance.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Lists Snipe-it Assets Maintenances 4 | 5 | .PARAMETER asset_id 6 | Asset ID of the asset you'd like to return maintenances for 7 | 8 | .PARAMETER search 9 | Search string 10 | 11 | .PARAMETER sort 12 | Specify the column name you wish to sort by 13 | 14 | .PARAMETER order 15 | Specify the order (asc or desc) you wish to order by on your sort column 16 | 17 | .PARAMETER limit 18 | Specify the number of results you wish to return. Defaults to 50. Defines batch size for -all 19 | 20 | .PARAMETER offset 21 | Offset to use 22 | 23 | .PARAMETER all 24 | A return all results, works with -offset and other parameters 25 | 26 | .PARAMETER url 27 | Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system. 28 | 29 | .PARAMETER apiKey 30 | Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit. 31 | 32 | .EXAMPLE 33 | Get-SnipeitAssetMaintenances 34 | .EXAMPLE 35 | Get-SnipeitAssetMaintenances -search "myMachine" 36 | 37 | .EXAMPLE 38 | Get-SnipeitAssetMaintenances -search "myMachine" 39 | #> 40 | function Get-SnipeitAssetMaintenance() { 41 | Param( 42 | [string]$search, 43 | 44 | [int]$asset_id, 45 | 46 | [string]$sort = "created_at", 47 | 48 | [ValidateSet("asc", "desc")] 49 | [string]$order = "desc", 50 | 51 | [int]$limit = 50, 52 | 53 | [switch]$all = $false, 54 | 55 | [int]$offset, 56 | 57 | [parameter(mandatory = $false)] 58 | [string]$url, 59 | 60 | [parameter(mandatory = $false)] 61 | [string]$apiKey 62 | ) 63 | begin { 64 | Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name 65 | 66 | $SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters 67 | 68 | $Parameters = @{ 69 | Api = "/api/v1/maintenances" 70 | Method = 'Get' 71 | GetParameters = $SearchParameter 72 | } 73 | 74 | if ($PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 75 | Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead." 76 | Set-SnipeitPSLegacyApiKey -apiKey $apikey 77 | } 78 | 79 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url) { 80 | Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." 81 | Set-SnipeitPSLegacyUrl -url $url 82 | } 83 | } 84 | 85 | process { 86 | if ($all) { 87 | $offstart = $(if ($offset) {$offset} Else {0}) 88 | $callargs = $SearchParameter 89 | $callargs.Remove('all') 90 | 91 | while ($true) { 92 | $callargs['offset'] = $offstart 93 | $callargs['limit'] = $limit 94 | $res=Get-SnipeitAssetMaintenance @callargs 95 | $res 96 | if ($res.count -lt $limit) { 97 | break 98 | } 99 | $offstart = $offstart + $limit 100 | } 101 | } else { 102 | $result = Invoke-SnipeitMethod @Parameters 103 | $result 104 | } 105 | } 106 | 107 | end { 108 | # reset legacy sessions 109 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url -or $PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 110 | Reset-SnipeitPSLegacyApi 111 | } 112 | } 113 | } 114 | 115 | 116 | 117 | 118 | 119 | 120 | -------------------------------------------------------------------------------- /SnipeitPS/Public/Get-SnipeitCustomField.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Returns specific Snipe-IT custom field or a list of all custom field 4 | 5 | .PARAMETER id 6 | A id of specific field 7 | 8 | .PARAMETER url 9 | Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system. 10 | 11 | .PARAMETER apiKey 12 | Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit. 13 | 14 | .EXAMPLE 15 | Get-SnipeitCustomField 16 | Get all custom fields 17 | 18 | .EXAMPLE 19 | Get-SnipeitCustomField -id 1 20 | Get custom field with ID 1 21 | 22 | 23 | #> 24 | 25 | function Get-SnipeitCustomField() { 26 | Param( 27 | [int]$id, 28 | 29 | [parameter(mandatory = $false)] 30 | [string]$url, 31 | 32 | [parameter(mandatory = $false)] 33 | [string]$apiKey 34 | ) 35 | 36 | begin { 37 | Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name 38 | 39 | if ($id) { 40 | $api= "/api/v1/fields/$id" 41 | } else { 42 | $api = "/api/v1/fields" 43 | } 44 | 45 | $Parameters = @{ 46 | Api = $api 47 | Method = 'Get' 48 | } 49 | 50 | if ($PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 51 | Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead." 52 | Set-SnipeitPSLegacyApiKey -apiKey $apikey 53 | } 54 | 55 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url) { 56 | Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." 57 | Set-SnipeitPSLegacyUrl -url $url 58 | } 59 | } 60 | 61 | process { 62 | $result = Invoke-SnipeitMethod @Parameters 63 | $result 64 | } 65 | 66 | end { 67 | # reset legacy sessions 68 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url -or $PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 69 | Reset-SnipeitPSLegacyApi 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /SnipeitPS/Public/Get-SnipeitFieldset.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Returns a fieldset or list of Snipe-it Fieldsets 4 | 5 | .PARAMETER id 6 | A id of specific fieldset 7 | 8 | .PARAMETER url 9 | Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system. 10 | 11 | .PARAMETER apiKey 12 | Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit. 13 | 14 | .EXAMPLE 15 | Get-SnipeitFieldset 16 | Get all fieldsets 17 | 18 | .EXAMPLE 19 | Get-SnipeitFieldset | Where-Object {$_.name -eq "Windows" } 20 | Gets fieldset by name 21 | 22 | #> 23 | 24 | function Get-SnipeitFieldset() { 25 | Param( 26 | [int]$id, 27 | 28 | [parameter(mandatory = $false)] 29 | [string]$url, 30 | 31 | [parameter(mandatory = $false)] 32 | [string]$apiKey 33 | ) 34 | begin { 35 | Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name 36 | 37 | if ($id) { 38 | $api = "/api/v1/fieldsets/$id" 39 | } else { 40 | $api = "/api/v1/fieldsets" 41 | } 42 | 43 | $Parameters = @{ 44 | Api = $api 45 | Method = 'Get' 46 | } 47 | 48 | if ($PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 49 | Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead." 50 | Set-SnipeitPSLegacyApiKey -apiKey $apikey 51 | } 52 | 53 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url) { 54 | Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." 55 | Set-SnipeitPSLegacyUrl -url $url 56 | } 57 | } 58 | process { 59 | $result = Invoke-SnipeitMethod @Parameters 60 | 61 | $result 62 | } 63 | end { 64 | # reset legacy sessions 65 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url -or $PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 66 | Reset-SnipeitPSLegacyApi 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /SnipeitPS/Public/Get-SnipeitLicenseSeat.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Gets a list of Snipe-it Licenses Seats or specific Seat 4 | 5 | .PARAMETER search 6 | A text string to search the Licenses data 7 | 8 | .PARAMETER id 9 | A id of specific License 10 | 11 | .PARAMETER seat_id 12 | A id of specific seat 13 | 14 | .PARAMETER limit 15 | Specify the number of results you wish to return. Defaults to 50. Defines batch size for -all 16 | 17 | .PARAMETER offset 18 | Offset to use 19 | 20 | .PARAMETER all 21 | A return all results, works with -offset and other parameters 22 | 23 | 24 | .PARAMETER url 25 | Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system. 26 | 27 | .PARAMETER apiKey 28 | Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit. 29 | 30 | .EXAMPLE 31 | Get-SnipeitLicenseSeat -id 1 32 | 33 | 34 | #> 35 | 36 | function Get-SnipeitLicenseSeat() { 37 | Param( 38 | 39 | [parameter(mandatory = $true)] 40 | [int]$id, 41 | 42 | [int]$seat_id, 43 | 44 | [int]$limit = 50, 45 | 46 | [int]$offset, 47 | 48 | [switch]$all = $false, 49 | 50 | [parameter(mandatory = $false)] 51 | [string]$url, 52 | 53 | [parameter(mandatory = $false)] 54 | [string]$apiKey 55 | ) 56 | begin { 57 | Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name 58 | 59 | $SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters -DefaultExcludeParameter 'url', 'apiKey', 'Debug', 'Verbose','RequestType' 60 | 61 | $api = "/api/v1/licenses/$id/seats" 62 | 63 | 64 | if ($seat_id) { 65 | $api= "/api/v1/licenses/$id/seats/$seat_id" 66 | } 67 | 68 | $Parameters = @{ 69 | Api = $api 70 | Method = 'Get' 71 | GetParameters = $SearchParameter 72 | } 73 | 74 | if ($PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 75 | Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead." 76 | Set-SnipeitPSLegacyApiKey -apiKey $apikey 77 | } 78 | 79 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url) { 80 | Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." 81 | Set-SnipeitPSLegacyUrl -url $url 82 | } 83 | } 84 | 85 | process { 86 | if ($all) { 87 | $offstart = $(if ($offset) {$offset} Else {0}) 88 | $callargs = $SearchParameter 89 | $callargs.Remove('all') 90 | 91 | while ($true) { 92 | $callargs['offset'] = $offstart 93 | $callargs['limit'] = $limit 94 | $res=Get-SnipeitLicenseSeat @callargs 95 | $res 96 | if ($res.count -lt $limit) { 97 | break 98 | } 99 | $offstart = $offstart + $limit 100 | } 101 | } else { 102 | $result = Invoke-SnipeitMethod @Parameters 103 | $result 104 | } 105 | } 106 | 107 | end { 108 | # reset legacy sessions 109 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url -or $PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 110 | Reset-SnipeitPSLegacyApi 111 | } 112 | } 113 | } 114 | 115 | -------------------------------------------------------------------------------- /SnipeitPS/Public/New-SnipeitAssetMaintenance.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Add a new Asset maintenence to Snipe-it asset system 4 | 5 | .DESCRIPTION 6 | Long description 7 | 8 | 9 | .PARAMETER title 10 | Required Title of maintenance 11 | 12 | .PARAMETER asset_id 13 | Required ID of the asset, this can be got using Get-Asset 14 | 15 | .PARAMETER supplier_id 16 | Required maintenance supplier 17 | 18 | .PARAMETER start_date 19 | Required start date 20 | 21 | .PARAMETER is_warranty 22 | Optional Maintenance done under warranty 23 | 24 | .PARAMETER cost 25 | Optional cost 26 | 27 | .PARAMETER comletion_date 28 | Optional completion date 29 | 30 | .PARAMETER notes 31 | Optional cost 32 | 33 | .PARAMETER url 34 | Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system. 35 | 36 | .PARAMETER apiKey 37 | Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit. 38 | 39 | .EXAMPLE 40 | New-SnipeitAssetMaintenence -asset_id 1 -supplier_id 1 -title "replace keyboard" -start_date 2021-01-01 41 | #> 42 | function New-SnipeitAssetMaintenance() { 43 | [CmdletBinding( 44 | SupportsShouldProcess = $true, 45 | ConfirmImpact = "Low" 46 | )] 47 | 48 | Param( 49 | [parameter(mandatory = $true)] 50 | [int]$asset_id, 51 | 52 | [parameter(mandatory = $true)] 53 | [int]$supplier_id, 54 | 55 | [parameter(mandatory = $true)] 56 | [string]$asset_maintenance_type, 57 | 58 | [parameter(mandatory = $true)] 59 | [string]$title, 60 | 61 | [parameter(mandatory = $true)] 62 | [datetime]$start_date, 63 | 64 | [parameter(mandatory = $false)] 65 | [datetime]$completion_date, 66 | 67 | [bool]$is_warranty = $false, 68 | 69 | [decimal]$cost, 70 | 71 | [string]$notes, 72 | 73 | [parameter(mandatory = $false)] 74 | [string]$url, 75 | 76 | [parameter(mandatory = $false)] 77 | [string]$apiKey 78 | ) 79 | begin { 80 | Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name 81 | 82 | $Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters 83 | 84 | if ($Values['start_date']) { 85 | $Values['start_date'] = $Values['start_date'].ToString("yyyy-MM-dd") 86 | } 87 | 88 | if ($Values['completion_date']) { 89 | $Values['completion_date'] = $Values['completion_date'].ToString("yyyy-MM-dd") 90 | } 91 | 92 | 93 | $Parameters = @{ 94 | Api = "/api/v1/maintenances" 95 | Method = 'Post' 96 | Body = $Values 97 | } 98 | 99 | if ($PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 100 | Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead." 101 | Set-SnipeitPSLegacyApiKey -apiKey $apikey 102 | } 103 | 104 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url) { 105 | Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." 106 | Set-SnipeitPSLegacyUrl -url $url 107 | } 108 | } 109 | 110 | process { 111 | if ($PSCmdlet.ShouldProcess("ShouldProcess?")) { 112 | $result = Invoke-SnipeitMethod @Parameters 113 | } 114 | 115 | $result 116 | } 117 | 118 | end { 119 | # reset legacy sessions 120 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url -or $PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 121 | Reset-SnipeitPSLegacyApi 122 | } 123 | } 124 | } 125 | -------------------------------------------------------------------------------- /SnipeitPS/Public/New-SnipeitAudit.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Add a new Audit to Snipe-it asset system 4 | 5 | .DESCRIPTION 6 | Long description 7 | 8 | .PARAMETER Tag 9 | The asset tag of the asset you wish to audit 10 | 11 | .PARAMETER next_audit_date 12 | Due date for the asset's next audit 13 | 14 | .PARAMETER Location_id 15 | ID of the location you want to associate with the audit 16 | 17 | .EXAMPLE 18 | New-SnipeitAudit -tag 1 -location_id 1 19 | 20 | #> 21 | 22 | function New-SnipeitAudit() { 23 | [CmdletBinding( 24 | SupportsShouldProcess = $true, 25 | ConfirmImpact = "Low" 26 | )] 27 | 28 | Param( 29 | [parameter(mandatory = $true)] 30 | [string]$tag, 31 | 32 | [int]$location_id, 33 | 34 | [parameter(mandatory = $false)] 35 | [datetime]$next_audit_date, 36 | 37 | [parameter(mandatory = $false)] 38 | [string]$url, 39 | 40 | [parameter(mandatory = $false)] 41 | [string]$apiKey 42 | 43 | ) 44 | begin { 45 | Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name 46 | 47 | $Values = @{ 48 | "location_id" = $location_id 49 | } 50 | 51 | if ($PSBoundParameters.ContainsKey('tag')) { 52 | $Values += @{"asset_tag" = $tag} 53 | } 54 | 55 | if ($PSBoundParameters.ContainsKey('next_audit_date')) { 56 | $Values += @{"next_audit_date" = ($next_audit_date).ToString("yyyy-MM-dd")} 57 | } 58 | 59 | $Parameters = @{ 60 | Api = "/api/v1/hardware/audit" 61 | Method = 'Post' 62 | Body = $Values 63 | } 64 | 65 | if ($PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 66 | Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead." 67 | Set-SnipeitPSLegacyApiKey -apiKey $apikey 68 | } 69 | 70 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url) { 71 | Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." 72 | Set-SnipeitPSLegacyUrl -url $url 73 | } 74 | } 75 | 76 | process { 77 | if ($PSCmdlet.ShouldProcess("ShouldProcess?")) { 78 | $result = Invoke-SnipeitMethod @Parameters 79 | } 80 | 81 | $result 82 | } 83 | 84 | end { 85 | # reset legacy sessions 86 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url -or $PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 87 | Reset-SnipeitPSLegacyApi 88 | } 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /SnipeitPS/Public/New-SnipeitCategory.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Create a new Snipe-IT Category 4 | 5 | .PARAMETER name 6 | Name of new category to be created 7 | 8 | .PARAMETER type 9 | Type of new category to be created (asset, accessory, consumable, component, license) 10 | 11 | .PARAMETER eula_text 12 | This allows you to customize your EULAs for specific types of assets 13 | 14 | .PARAMETER use_default_eula 15 | If switch is present, use the primary default EULA 16 | 17 | .PARAMETER require_acceptance 18 | If switch is present, require users to confirm acceptance of assets in this category 19 | 20 | .PARAMETER checkin_email 21 | If switch is present, send email to user on checkin/checkout 22 | 23 | .PARAMETER image 24 | Category image filename and path 25 | 26 | .PARAMETER url 27 | Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system. 28 | 29 | .PARAMETER apiKey 30 | Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key API Key for Snipeit. 31 | 32 | .EXAMPLE 33 | New-SnipeitCategory -name "Laptops" -category_type asset 34 | #> 35 | 36 | function New-SnipeitCategory() { 37 | [CmdletBinding( 38 | SupportsShouldProcess = $true, 39 | ConfirmImpact = "Low" 40 | )] 41 | 42 | Param( 43 | [parameter(mandatory = $true)] 44 | [string]$name, 45 | 46 | [parameter(mandatory = $true)] 47 | [ValidateSet("asset", "accessory", "consumable", "component", "license")] 48 | [string]$category_type, 49 | 50 | [string]$eula_text, 51 | 52 | [switch]$use_default_eula, 53 | 54 | [switch]$require_acceptance, 55 | 56 | [switch]$checkin_email, 57 | 58 | [ValidateScript({Test-Path $_})] 59 | [string]$image, 60 | 61 | [parameter(mandatory = $false)] 62 | [string]$url, 63 | 64 | [parameter(mandatory = $false)] 65 | [string]$apiKey 66 | 67 | ) 68 | begin { 69 | Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name 70 | 71 | if ($eula_text -and $use_default_eula) { 72 | throw 'Dont use -use_defalt_eula if -eula_text is set' 73 | } 74 | 75 | $Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters 76 | } 77 | 78 | process { 79 | 80 | $Parameters = @{ 81 | Api = "/api/v1/categories" 82 | Method = 'POST' 83 | Body = $Values 84 | } 85 | 86 | if ($PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 87 | Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead." 88 | Set-SnipeitPSLegacyApiKey -apiKey $apikey 89 | } 90 | 91 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url) { 92 | Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." 93 | Set-SnipeitPSLegacyUrl -url $url 94 | } 95 | 96 | if ($PSCmdlet.ShouldProcess("ShouldProcess?")) { 97 | $result = Invoke-SnipeitMethod @Parameters 98 | } 99 | 100 | $result 101 | } 102 | 103 | end { 104 | # reset legacy sessions 105 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url -or $PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 106 | Reset-SnipeitPSLegacyApi 107 | } 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /SnipeitPS/Public/New-SnipeitCompany.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Creates a new Company 4 | 5 | .DESCRIPTION 6 | Creates new company on Snipe-It system 7 | 8 | .PARAMETER name 9 | Comapany name 10 | 11 | .PARAMETER image 12 | Company image filename and path 13 | 14 | .PARAMETER url 15 | Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system. 16 | 17 | .PARAMETER apiKey 18 | Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key API Key for Snipeit. 19 | 20 | .EXAMPLE 21 | New-SnipeitCompany -name "Acme Company" 22 | 23 | #> 24 | 25 | function New-SnipeitCompany() { 26 | [CmdletBinding( 27 | SupportsShouldProcess = $true, 28 | ConfirmImpact = "Low" 29 | )] 30 | 31 | Param( 32 | [parameter(mandatory = $true)] 33 | [string]$name, 34 | 35 | [ValidateScript({Test-Path $_})] 36 | [string]$image, 37 | 38 | [parameter(mandatory = $false)] 39 | [string]$url, 40 | 41 | [parameter(mandatory = $false)] 42 | [string]$apiKey 43 | ) 44 | begin { 45 | Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name 46 | 47 | $Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters 48 | 49 | $Parameters = @{ 50 | Api = "/api/v1/companies" 51 | Method = 'POST' 52 | Body = $Values 53 | } 54 | 55 | if ($PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 56 | Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead." 57 | Set-SnipeitPSLegacyApiKey -apiKey $apikey 58 | } 59 | 60 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url) { 61 | Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." 62 | Set-SnipeitPSLegacyUrl -url $url 63 | } 64 | } 65 | 66 | process { 67 | if ($PSCmdlet.ShouldProcess("ShouldProcess?")) { 68 | $result = Invoke-SnipeitMethod @Parameters 69 | } 70 | 71 | $result 72 | } 73 | 74 | end { 75 | # reset legacy sessions 76 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url -or $PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 77 | Reset-SnipeitPSLegacyApi 78 | } 79 | } 80 | } 81 | 82 | -------------------------------------------------------------------------------- /SnipeitPS/Public/New-SnipeitComponent.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Create a new component 4 | 5 | .DESCRIPTION 6 | Createa new componen on Snipe-It system 7 | 8 | .PARAMETER name 9 | Component name 10 | 11 | .PARAMETER category_id 12 | ID number of category 13 | 14 | .PARAMETER qty 15 | Quantity of the components you have 16 | 17 | .PARAMETER location_id 18 | ID number of the location the accessory is assigned to 19 | 20 | .PARAMETER order_number 21 | Order number of the component 22 | 23 | .PARAMETER purchase_date 24 | Date accessory was purchased 25 | 26 | .PARAMETER purchase_cost 27 | Cost of item being purchased. 28 | 29 | .PARAMETER image 30 | Component image filename and path 31 | 32 | .PARAMETER url 33 | Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system. 34 | 35 | .PARAMETER apiKey 36 | Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key API Key for Snipeit. 37 | 38 | .EXAMPLE 39 | New-SnipeitComponent -name 'Display adapter' -catecory_id 3 -qty 10 40 | 41 | 42 | #> 43 | 44 | function New-SnipeitComponent() { 45 | [CmdletBinding( 46 | SupportsShouldProcess = $true, 47 | ConfirmImpact = "Low" 48 | )] 49 | 50 | Param( 51 | [parameter(mandatory = $true)] 52 | [string]$name, 53 | 54 | [parameter(mandatory = $true)] 55 | [int]$category_id, 56 | 57 | [parameter(mandatory = $true)] 58 | [string]$qty, 59 | 60 | [int]$company_id, 61 | 62 | [int]$location_id, 63 | 64 | [string]$order_number, 65 | 66 | [datetime]$purchase_date, 67 | 68 | [float]$purchase_cost, 69 | 70 | [ValidateScript({Test-Path $_})] 71 | [string]$image, 72 | 73 | [parameter(mandatory = $false)] 74 | [string]$url, 75 | 76 | [parameter(mandatory = $false)] 77 | [string]$apiKey 78 | ) 79 | begin { 80 | Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name 81 | 82 | $Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters 83 | 84 | if ($Values['purchase_date']) { 85 | $Values['purchase_date'] = $Values['purchase_date'].ToString("yyyy-MM-dd") 86 | } 87 | 88 | $Parameters = @{ 89 | Api = "/api/v1/components" 90 | Method = 'POST' 91 | Body = $Values 92 | } 93 | 94 | if ($PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 95 | Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead." 96 | Set-SnipeitPSLegacyApiKey -apiKey $apikey 97 | } 98 | 99 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url) { 100 | Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." 101 | Set-SnipeitPSLegacyUrl -url $url 102 | } 103 | } 104 | 105 | process { 106 | if ($PSCmdlet.ShouldProcess("ShouldProcess?")) { 107 | $result = Invoke-SnipeitMethod @Parameters 108 | } 109 | 110 | $result 111 | } 112 | 113 | end { 114 | # reset legacy sessions 115 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url -or $PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 116 | Reset-SnipeitPSLegacyApi 117 | } 118 | } 119 | } 120 | 121 | -------------------------------------------------------------------------------- /SnipeitPS/Public/New-SnipeitDepartment.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Creates a department 4 | 5 | .DESCRIPTION 6 | Creates a new department on Snipe-It system 7 | 8 | .PARAMETER name 9 | Department Name 10 | 11 | .PARAMETER company_id 12 | ID number of company 13 | 14 | .PARAMETER location_id 15 | ID number of location 16 | 17 | .PARAMETER manager_id 18 | ID number of manager 19 | 20 | .PARAMETER image 21 | Department Image filename and path 22 | 23 | .PARAMETER url 24 | Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system. 25 | 26 | .PARAMETER apiKey 27 | Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit. 28 | 29 | .EXAMPLE 30 | New-SnipeitDepartment -name "Department1" -company_id 1 -localtion_id 1 -manager_id 3 31 | 32 | #> 33 | 34 | function New-SnipeitDepartment() { 35 | [CmdletBinding( 36 | SupportsShouldProcess = $true, 37 | ConfirmImpact = "Low" 38 | )] 39 | 40 | Param( 41 | [parameter(mandatory = $true)] 42 | [string]$name, 43 | 44 | [int]$company_id, 45 | 46 | [int]$location_id, 47 | 48 | [int]$manager_id, 49 | 50 | [string]$notes, 51 | 52 | [ValidateScript({Test-Path $_})] 53 | [string]$image, 54 | 55 | [switch]$image_delete=$false, 56 | 57 | [parameter(mandatory = $false)] 58 | [string]$url, 59 | 60 | [parameter(mandatory = $false)] 61 | [string]$apiKey 62 | ) 63 | begin { 64 | Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name 65 | 66 | $Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters 67 | 68 | $Parameters = @{ 69 | Api = "/api/v1/departments" 70 | Method = 'POST' 71 | Body = $Values 72 | } 73 | 74 | if ($PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 75 | Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead." 76 | Set-SnipeitPSLegacyApiKey -apiKey $apikey 77 | } 78 | 79 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url) { 80 | Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." 81 | Set-SnipeitPSLegacyUrl -url $url 82 | } 83 | } 84 | 85 | process { 86 | if ($PSCmdlet.ShouldProcess("ShouldProcess?")) { 87 | $result = Invoke-SnipeitMethod @Parameters 88 | } 89 | 90 | $result 91 | } 92 | 93 | end { 94 | # reset legacy sessions 95 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url -or $PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 96 | Reset-SnipeitPSLegacyApi 97 | } 98 | } 99 | } 100 | 101 | -------------------------------------------------------------------------------- /SnipeitPS/Public/New-SnipeitLocation.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Add a new Location to Snipe-it asset system 4 | 5 | .DESCRIPTION 6 | Long description 7 | 8 | .PARAMETER name 9 | Name of the Location 10 | 11 | .PARAMETER address 12 | Address line 1 of the location 13 | 14 | .PARAMETER address2 15 | Address line 2 of the location 16 | 17 | .PARAMETER state 18 | Address State of the location 19 | 20 | .PARAMETER country 21 | Country of the location 22 | 23 | .PARAMETER zip 24 | The zip code of the location 25 | 26 | .PARAMETER ldap_ou 27 | The LDAP OU of the location 28 | 29 | .PARAMETER parent_id 30 | Parent location ID for the location 31 | 32 | .PARAMETER currency 33 | Currency used at the location 34 | 35 | .PARAMETER city 36 | City of the location 37 | 38 | .PARAMETER manager_id 39 | The manager ID of the location 40 | 41 | .PARAMETER image 42 | Location Image filename and path 43 | 44 | .PARAMETER url 45 | Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system. 46 | 47 | .PARAMETER apiKey 48 | Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit. 49 | 50 | .EXAMPLE 51 | New-SnipeitLocation -name "Room 1" -address "123 Asset Street" -parent_id 14 52 | #> 53 | 54 | function New-SnipeitLocation() { 55 | [CmdletBinding( 56 | SupportsShouldProcess = $true, 57 | ConfirmImpact = "Low" 58 | )] 59 | 60 | Param( 61 | [parameter(mandatory = $true)] 62 | [string]$name, 63 | 64 | [string]$address, 65 | 66 | [string]$address2, 67 | 68 | [string]$city, 69 | 70 | [string]$state, 71 | 72 | [string]$country, 73 | 74 | [string]$zip, 75 | 76 | [string]$currency, 77 | 78 | [int]$parent_id, 79 | 80 | [int]$manager_id, 81 | 82 | [string]$ldap_ou, 83 | 84 | [ValidateScript({Test-Path $_})] 85 | [string]$image, 86 | 87 | [switch]$image_delete=$false, 88 | 89 | [parameter(mandatory = $false)] 90 | [string]$url, 91 | 92 | [parameter(mandatory = $false)] 93 | [string]$apiKey 94 | ) 95 | 96 | begin { 97 | Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name 98 | 99 | $Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters 100 | 101 | $Parameters = @{ 102 | Api = "/api/v1/locations" 103 | Method = 'post' 104 | Body = $Values 105 | } 106 | 107 | if ($PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 108 | Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead." 109 | Set-SnipeitPSLegacyApiKey -apiKey $apikey 110 | } 111 | 112 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url) { 113 | Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." 114 | Set-SnipeitPSLegacyUrl -url $url 115 | } 116 | } 117 | 118 | process { 119 | if ($PSCmdlet.ShouldProcess("ShouldProcess?")) { 120 | $result = Invoke-SnipeitMethod @Parameters 121 | } 122 | 123 | $result 124 | } 125 | 126 | end { 127 | # reset legacy sessions 128 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url -or $PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 129 | Reset-SnipeitPSLegacyApi 130 | } 131 | } 132 | } 133 | -------------------------------------------------------------------------------- /SnipeitPS/Public/New-SnipeitManufacturer.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Add a new Manufacturer to Snipe-it asset system 4 | 5 | .DESCRIPTION 6 | Long description 7 | 8 | .PARAMETER Name 9 | Name of the Manufacturer 10 | 11 | .PARAMETER image 12 | Manufacturer Image filename and path 13 | 14 | .PARAMETER image_delete 15 | Remove current image 16 | 17 | .PARAMETER url 18 | Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system. 19 | 20 | .PARAMETER apiKey 21 | Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit. 22 | 23 | .EXAMPLE 24 | New-SnipeitManufacturer -name "HP" 25 | #> 26 | 27 | function New-SnipeitManufacturer() { 28 | [CmdletBinding( 29 | SupportsShouldProcess = $true, 30 | ConfirmImpact = "Low" 31 | )] 32 | 33 | Param( 34 | [parameter(mandatory = $true)] 35 | [string]$Name, 36 | 37 | [ValidateScript({Test-Path $_})] 38 | [string]$image, 39 | 40 | [switch]$image_delete=$false, 41 | 42 | [parameter(mandatory = $false)] 43 | [string]$url, 44 | 45 | [parameter(mandatory = $false)] 46 | [string]$apiKey 47 | ) 48 | 49 | begin { 50 | Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name 51 | 52 | $Values = @{ 53 | "name" = $Name 54 | } 55 | 56 | $Parameters = @{ 57 | Api = "/api/v1/manufacturers" 58 | Method = 'post' 59 | Body = $Values 60 | } 61 | 62 | if ($PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 63 | Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead." 64 | Set-SnipeitPSLegacyApiKey -apiKey $apikey 65 | } 66 | 67 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url) { 68 | Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." 69 | Set-SnipeitPSLegacyUrl -url $url 70 | } 71 | } 72 | process { 73 | if ($PSCmdlet.ShouldProcess("ShouldProcess?")) { 74 | $result = Invoke-SnipeitMethod @Parameters 75 | } 76 | 77 | $result 78 | } 79 | end { 80 | # reset legacy sessions 81 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url -or $PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 82 | Reset-SnipeitPSLegacyApi 83 | } 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /SnipeitPS/Public/New-SnipeitModel.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Add a new Model to Snipe-it asset system 4 | 5 | .DESCRIPTION 6 | Long description 7 | 8 | .PARAMETER name 9 | Name of the Asset Model 10 | 11 | .PARAMETER model_number 12 | Model number of the Asset Model 13 | 14 | .PARAMETER category_id 15 | Category ID that the asset belongs to this can be got using Get-Category 16 | 17 | .PARAMETER manufacturer_id 18 | Manufacturer ID that the asset belongs to this can be got using Get-Manufacturer 19 | 20 | .PARAMETER fieldset_id 21 | Fieldset ID that the asset uses (Custom fields) 22 | 23 | .PARAMETER image 24 | Asset model Image filename and path 25 | 26 | .PARAMETER url 27 | Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system. 28 | 29 | .PARAMETER apiKey 30 | Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit. 31 | 32 | .EXAMPLE 33 | New-SnipeitModel -name "DL380" -manufacturer_id 2 -fieldset_id 2 -category_id 1 34 | #> 35 | 36 | function New-SnipeitModel() { 37 | [CmdletBinding( 38 | SupportsShouldProcess = $true, 39 | ConfirmImpact = "Low" 40 | )] 41 | 42 | Param( 43 | [parameter(mandatory = $true)] 44 | [string]$name, 45 | 46 | [string]$model_number, 47 | 48 | [parameter(mandatory = $true)] 49 | [int]$category_id, 50 | 51 | [parameter(mandatory = $true)] 52 | [int]$manufacturer_id, 53 | 54 | [int]$eol, 55 | 56 | [parameter(mandatory = $false)] 57 | [int]$fieldset_id, 58 | 59 | [ValidateScript({Test-Path $_})] 60 | [string]$image, 61 | 62 | [parameter(mandatory = $false)] 63 | [string]$url, 64 | 65 | [parameter(mandatory = $false)] 66 | [string]$apiKey 67 | ) 68 | 69 | begin { 70 | Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name 71 | 72 | $Values = @{ 73 | name = $name 74 | category_id = $category_id 75 | manufacturer_id = $manufacturer_id 76 | fieldset_id = $fieldset_id 77 | } 78 | 79 | if ($PSBoundParameters.ContainsKey('model_number')) { $Values.Add("model_number", $model_number) } 80 | if ($PSBoundParameters.ContainsKey('eol')) { $Values.Add("eol", $eol) } 81 | 82 | 83 | $Parameters = @{ 84 | Api = "/api/v1/models" 85 | Method = 'post' 86 | Body = $Values 87 | } 88 | 89 | if ($PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 90 | Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead." 91 | Set-SnipeitPSLegacyApiKey -apiKey $apikey 92 | } 93 | 94 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url) { 95 | Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." 96 | Set-SnipeitPSLegacyUrl -url $url 97 | } 98 | } 99 | 100 | process { 101 | if ($PSCmdlet.ShouldProcess("ShouldProcess?")) { 102 | $result = Invoke-SnipeitMethod @Parameters 103 | } 104 | 105 | $result 106 | } 107 | 108 | end { 109 | # reset legacy sessions 110 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url -or $PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 111 | Reset-SnipeitPSLegacyApi 112 | } 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /SnipeitPS/Public/New-SnipeitSupplier.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Creates a supplier 4 | 5 | .DESCRIPTION 6 | Creates a new supplier on Snipe-It system 7 | 8 | .PARAMETER name 9 | Department Name 10 | 11 | .PARAMETER address 12 | Address line 1 of supplier 13 | 14 | .PARAMETER address2 15 | Address line 1 of supplier 16 | 17 | .PARAMETER city 18 | City 19 | 20 | .PARAMETER state 21 | State 22 | 23 | .PARAMETER country 24 | Country 25 | 26 | .PARAMETER zip 27 | Zip code 28 | 29 | .PARAMETER phone 30 | Phone number 31 | 32 | .PARAMETER fax 33 | Fax number 34 | 35 | .PARAMETER email 36 | Email address 37 | 38 | .PARAMETER contact 39 | Contact person 40 | 41 | .PARAMETER notes 42 | Email address 43 | 44 | .PARAMETER image 45 | Image file name and path for item 46 | 47 | .PARAMETER url 48 | Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system. 49 | 50 | .PARAMETER apiKey 51 | Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit. 52 | 53 | .EXAMPLE 54 | New-SnipeitDepartment -name "Department1" -company_id 1 -localtion_id 1 -manager_id 3 55 | 56 | #> 57 | 58 | function New-SnipeitSupplier() { 59 | [CmdletBinding( 60 | SupportsShouldProcess = $true, 61 | ConfirmImpact = "Low" 62 | )] 63 | 64 | Param( 65 | [parameter(mandatory = $true)] 66 | [string]$name, 67 | 68 | [string]$address, 69 | 70 | [string]$address2, 71 | 72 | [string]$city, 73 | 74 | [string]$state, 75 | 76 | [string]$country, 77 | 78 | [string]$zip, 79 | 80 | [string]$phone, 81 | 82 | [string]$fax, 83 | 84 | [string]$email, 85 | 86 | [string]$contact, 87 | 88 | [string]$notes, 89 | 90 | [ValidateScript({Test-Path $_})] 91 | [string]$image, 92 | 93 | [parameter(mandatory = $false)] 94 | [string]$url, 95 | 96 | [parameter(mandatory = $false)] 97 | [string]$apiKey 98 | ) 99 | begin { 100 | Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name 101 | 102 | $Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters 103 | 104 | $Parameters = @{ 105 | Api = "/api/v1/suppilers" 106 | Method = 'POST' 107 | Body = $Values 108 | } 109 | 110 | if ($PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 111 | Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead." 112 | Set-SnipeitPSLegacyApiKey -apiKey $apikey 113 | } 114 | 115 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url) { 116 | Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." 117 | Set-SnipeitPSLegacyUrl -url $url 118 | } 119 | } 120 | 121 | process { 122 | if ($PSCmdlet.ShouldProcess("ShouldProcess?")) { 123 | $result = Invoke-SnipeitMethod @Parameters 124 | } 125 | 126 | $result 127 | } 128 | 129 | end { 130 | # reset legacy sessions 131 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url -or $PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 132 | Reset-SnipeitPSLegacyApi 133 | } 134 | } 135 | } 136 | 137 | -------------------------------------------------------------------------------- /SnipeitPS/Public/Remove-SnipeitAccessory.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Removes Accessory from Snipe-it asset system 4 | .DESCRIPTION 5 | Removes Accessory or multiple Accessoriers from Snipe-it asset system 6 | .PARAMETER ID 7 | Unique ID For accessory to be removed 8 | .PARAMETER url 9 | Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system. 10 | 11 | .PARAMETER apiKey 12 | Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit. 13 | 14 | .EXAMPLE 15 | Remove-SnipeitAccessory -ID 44 -Verbose 16 | 17 | .EXAMPLE 18 | Get-SnipeitAccessory -search needle | Remove-SnipeitAccessory 19 | #> 20 | 21 | function Remove-SnipeitAccessory () { 22 | [CmdletBinding( 23 | SupportsShouldProcess = $true, 24 | ConfirmImpact = "Low" 25 | )] 26 | 27 | Param( 28 | [parameter(mandatory = $true,ValueFromPipelineByPropertyName)] 29 | [int[]]$id, 30 | 31 | [parameter(mandatory = $false)] 32 | [string]$url, 33 | 34 | [parameter(mandatory = $false)] 35 | [string]$apiKey 36 | ) 37 | 38 | begin { 39 | } 40 | 41 | process { 42 | foreach($accessory_id in $id) { 43 | $Parameters = @{ 44 | Api = "/api/v1/accessories/$accessory_id" 45 | Method = 'Delete' 46 | } 47 | 48 | if ($PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 49 | Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead." 50 | Set-SnipeitPSLegacyApiKey -apiKey $apikey 51 | } 52 | 53 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url) { 54 | Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." 55 | Set-SnipeitPSLegacyUrl -url $url 56 | } 57 | 58 | if ($PSCmdlet.ShouldProcess("ShouldProcess?")) { 59 | $result = Invoke-SnipeitMethod @Parameters 60 | } 61 | 62 | $result 63 | } 64 | } 65 | 66 | end { 67 | # reset legacy sessions 68 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url -or $PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 69 | Reset-SnipeitPSLegacyApi 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /SnipeitPS/Public/Remove-SnipeitAsset.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Removes Asset from Snipe-it asset system 4 | .DESCRIPTION 5 | Removes asset or multiple assets from Snipe-it asset system 6 | .PARAMETER ID 7 | Unique ID For Asset to be removed 8 | .PARAMETER url 9 | Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system. 10 | 11 | .PARAMETER apiKey 12 | Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit. 13 | 14 | .EXAMPLE 15 | Remove-SnipeitAsset -ID 44 -Verbose 16 | 17 | .EXAMPLE 18 | Get-SnipeitAsset -serial 123456789 | Remove-SnipeitAsset 19 | #> 20 | 21 | function Remove-SnipeitAsset () { 22 | [CmdletBinding( 23 | SupportsShouldProcess = $true, 24 | ConfirmImpact = "Low" 25 | )] 26 | 27 | Param( 28 | [parameter(mandatory = $true,ValueFromPipelineByPropertyName)] 29 | [int[]]$id, 30 | 31 | [parameter(mandatory = $false)] 32 | [string]$url, 33 | 34 | [parameter(mandatory = $false)] 35 | [string]$apiKey 36 | ) 37 | 38 | begin { 39 | Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name 40 | } 41 | 42 | process { 43 | foreach($asset_id in $id) { 44 | $Parameters = @{ 45 | Api = "/api/v1/hardware/$asset_id" 46 | Method = 'Delete' 47 | } 48 | 49 | if ($PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 50 | Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead." 51 | Set-SnipeitPSLegacyApiKey -apiKey $apikey 52 | } 53 | 54 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url) { 55 | Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." 56 | Set-SnipeitPSLegacyUrl -url $url 57 | } 58 | 59 | if ($PSCmdlet.ShouldProcess("ShouldProcess?")) { 60 | $result = Invoke-SnipeitMethod @Parameters 61 | } 62 | 63 | $result 64 | } 65 | } 66 | 67 | end { 68 | # reset legacy sessions 69 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url -or $PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 70 | Reset-SnipeitPSLegacyApi 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /SnipeitPS/Public/Remove-SnipeitAssetMaintenance.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Remove asset maintenance from Snipe-it asset system 4 | 5 | .DESCRIPTION 6 | Removes asset maintenance event or events from Snipe-it asset system by ID 7 | 8 | .PARAMETER ID 9 | Unique ID of the asset maintenance to be removed 10 | 11 | .PARAMETER url 12 | Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system. 13 | .PARAMETER url 14 | Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit. 15 | 16 | .EXAMPLE 17 | Remove-SnipeitAssetMaintenance -ID 44 18 | #> 19 | function Remove-SnipeitAssetMaintenance { 20 | 21 | [CmdletBinding( 22 | SupportsShouldProcess = $true, 23 | ConfirmImpact = "Low" 24 | )] 25 | param ( 26 | [Parameter(Mandatory = $true,ValueFromPipelineByPropertyName)] 27 | [int[]] 28 | $id, 29 | 30 | [parameter(mandatory = $false)] 31 | [string]$url, 32 | 33 | [parameter(mandatory = $false)] 34 | [string]$apiKey 35 | ) 36 | 37 | begin { 38 | Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name 39 | } 40 | 41 | process { 42 | foreach($maintenance_id in $id) { 43 | $Parameters = @{ 44 | Api = "/api/v1/maintenances/$maintenance_id" 45 | Method = 'Delete' 46 | } 47 | 48 | if ($PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 49 | Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead." 50 | Set-SnipeitPSLegacyApiKey -apiKey $apikey 51 | } 52 | 53 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url) { 54 | Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." 55 | Set-SnipeitPSLegacyUrl -url $url 56 | } 57 | 58 | if ($PSCmdlet.ShouldProcess("ShouldProcess?")) { 59 | $result = Invoke-SnipeitMethod @Parameters 60 | } 61 | 62 | $result 63 | } 64 | } 65 | 66 | end { 67 | # reset legacy sessions 68 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url -or $PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 69 | Reset-SnipeitPSLegacyApi 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /SnipeitPS/Public/Remove-SnipeitCategory.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Removes category from Snipe-it asset system 4 | .DESCRIPTION 5 | Removes category or multiple categories from Snipe-it asset system 6 | .PARAMETER ID 7 | Unique ID For categoryto be removed 8 | .PARAMETER url 9 | Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system. 10 | 11 | .PARAMETER apiKey 12 | Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit. 13 | 14 | .EXAMPLE 15 | Remove-SnipeitCategory -ID 44 16 | 17 | .EXAMPLE 18 | Get-SnipeitCategory -search something | Remove-SnipeitCategory 19 | #> 20 | 21 | function Remove-SnipeitCategory () { 22 | [CmdletBinding( 23 | SupportsShouldProcess = $true, 24 | ConfirmImpact = "Low" 25 | )] 26 | 27 | Param( 28 | [parameter(mandatory = $true,ValueFromPipelineByPropertyName)] 29 | [int[]]$id, 30 | 31 | [parameter(mandatory = $false)] 32 | [string]$url, 33 | 34 | [parameter(mandatory = $false)] 35 | [string]$apiKey 36 | 37 | ) 38 | begin { 39 | } 40 | process { 41 | foreach($category_id in $id) { 42 | $Parameters = @{ 43 | Api = "/api/v1/categories/$category_id" 44 | Method = 'Delete' 45 | } 46 | 47 | if ($PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 48 | Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead." 49 | Set-SnipeitPSLegacyApiKey -apiKey $apikey 50 | } 51 | 52 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url) { 53 | Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." 54 | Set-SnipeitPSLegacyUrl -url $url 55 | } 56 | 57 | if ($PSCmdlet.ShouldProcess("ShouldProcess?")) { 58 | $result = Invoke-SnipeitMethod @Parameters 59 | } 60 | 61 | $result 62 | } 63 | } 64 | 65 | end { 66 | # reset legacy sessions 67 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url -or $PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 68 | Reset-SnipeitPSLegacyApi 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /SnipeitPS/Public/Remove-SnipeitCompany.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Removes Company from Snipe-it asset system 4 | .DESCRIPTION 5 | Removes Company or multiple Companies from Snipe-it asset system 6 | .PARAMETER ID 7 | Unique ID For Company to be removed 8 | .PARAMETER url 9 | Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system. 10 | 11 | .PARAMETER apiKey 12 | Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit. 13 | 14 | .EXAMPLE 15 | Remove-SnipeitCompany -ID 44 16 | 17 | .EXAMPLE 18 | Get-SnipeitCompany | | Where-object {$_.name -like '*some*'} | Remove-SnipeitCompany 19 | #> 20 | 21 | function Remove-SnipeitCompany () { 22 | [CmdletBinding( 23 | SupportsShouldProcess = $true, 24 | ConfirmImpact = "Low" 25 | )] 26 | 27 | Param( 28 | [parameter(mandatory = $true,ValueFromPipelineByPropertyName)] 29 | [int[]]$id, 30 | 31 | [parameter(mandatory = $false)] 32 | [string]$url, 33 | 34 | [parameter(mandatory = $false)] 35 | [string]$apiKey 36 | 37 | ) 38 | begin { 39 | } 40 | process { 41 | foreach($company_id in $id) { 42 | $Parameters = @{ 43 | Api = "/api/v1/companies/$company_id" 44 | Method = 'Delete' 45 | } 46 | 47 | if ($PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 48 | Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead." 49 | Set-SnipeitPSLegacyApiKey -apiKey $apikey 50 | } 51 | 52 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url) { 53 | Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." 54 | Set-SnipeitPSLegacyUrl -url $url 55 | } 56 | 57 | if ($PSCmdlet.ShouldProcess("ShouldProcess?")) { 58 | $result = Invoke-SnipeitMethod @Parameters 59 | } 60 | 61 | $result 62 | } 63 | } 64 | 65 | end { 66 | # reset legacy sessions 67 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url -or $PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 68 | Reset-SnipeitPSLegacyApi 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /SnipeitPS/Public/Remove-SnipeitComponent.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Removes component from Snipe-it asset system 4 | .DESCRIPTION 5 | Removes component or multiple components from Snipe-it asset system 6 | .PARAMETER IDs 7 | Unique ID For component to be removed 8 | .PARAMETER url 9 | Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system. 10 | 11 | .PARAMETER apiKey 12 | Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit. 13 | 14 | .EXAMPLE 15 | Remove-SnipeitComponent -ID 44 16 | 17 | .EXAMPLE 18 | Get-SnipeitComponent -search 123456789 | Remove-SnipeitComponent 19 | #> 20 | 21 | function Remove-SnipeitComponent () { 22 | [CmdletBinding( 23 | SupportsShouldProcess = $true, 24 | ConfirmImpact = "Low" 25 | )] 26 | 27 | Param( 28 | [parameter(mandatory = $true,ValueFromPipelineByPropertyName)] 29 | [int[]]$id, 30 | 31 | [parameter(mandatory = $false)] 32 | [string]$url, 33 | 34 | [parameter(mandatory = $false)] 35 | [string]$apiKey 36 | ) 37 | 38 | begin { 39 | } 40 | 41 | process { 42 | foreach($component_id in $id) { 43 | $Parameters = @{ 44 | Api = "/api/v1/components/$component_id" 45 | Method = 'Delete' 46 | } 47 | 48 | if ($PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 49 | Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead." 50 | Set-SnipeitPSLegacyApiKey -apiKey $apikey 51 | } 52 | 53 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url) { 54 | Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." 55 | Set-SnipeitPSLegacyUrl -url $url 56 | } 57 | 58 | if ($PSCmdlet.ShouldProcess("ShouldProcess?")) { 59 | $result = Invoke-SnipeitMethod @Parameters 60 | } 61 | 62 | $result 63 | } 64 | } 65 | 66 | end { 67 | # reset legacy sessions 68 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url -or $PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 69 | Reset-SnipeitPSLegacyApi 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /SnipeitPS/Public/Remove-SnipeitConsumable.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Removes consumable from Snipe-it asset system 4 | .DESCRIPTION 5 | Removes consumable or multiple consumables from Snipe-it asset system 6 | .PARAMETER ID 7 | Unique ID For consumable to be removed 8 | 9 | .PARAMETER url 10 | Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system. 11 | 12 | .PARAMETER apiKey 13 | Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit. 14 | 15 | .EXAMPLE 16 | Remove-SnipeitConsumable -ID 44 17 | 18 | .EXAMPLE 19 | Get-SnipeitConsumable -search "paper" | Remove-SnipeitConsumable 20 | #> 21 | 22 | function Remove-SnipeitConsumable () { 23 | [CmdletBinding( 24 | SupportsShouldProcess = $true, 25 | ConfirmImpact = "Low" 26 | )] 27 | 28 | Param( 29 | [parameter(mandatory = $true,ValueFromPipelineByPropertyName)] 30 | [int[]]$id, 31 | 32 | [parameter(mandatory = $false)] 33 | [string]$url, 34 | 35 | [parameter(mandatory = $false)] 36 | [string]$apiKey 37 | ) 38 | 39 | begin { 40 | } 41 | 42 | process { 43 | foreach($consumable_id in $id) { 44 | $Parameters = @{ 45 | Api = "/api/v1/consumables/$consumable_id" 46 | Method = 'Delete' 47 | } 48 | 49 | if ($PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 50 | Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead." 51 | Set-SnipeitPSLegacyApiKey -apiKey $apikey 52 | } 53 | 54 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url) { 55 | Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." 56 | Set-SnipeitPSLegacyUrl -url $url 57 | } 58 | 59 | if ($PSCmdlet.ShouldProcess("ShouldProcess?")) { 60 | $result = Invoke-SnipeitMethod @Parameters 61 | } 62 | 63 | $result 64 | } 65 | } 66 | 67 | end { 68 | # reset legacy sessions 69 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url -or $PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 70 | Reset-SnipeitPSLegacyApi 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /SnipeitPS/Public/Remove-SnipeitCustomField.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Removes custom field from Snipe-it asset system 4 | .DESCRIPTION 5 | Removes custom field or multiple fields from Snipe-it asset system 6 | .PARAMETER ID 7 | Unique ID For field to be removed 8 | .PARAMETER url 9 | Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system. 10 | 11 | .PARAMETER apiKey 12 | Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit. 13 | 14 | .EXAMPLE 15 | Remove-SnipeitCustomField -ID 44 -Verbose 16 | 17 | .EXAMPLE 18 | Get-SnipeitCustomField | Where-object {$_.name -like '*address*'} | Remove-SnipeitCustomField 19 | #> 20 | 21 | function Remove-SnipeitCustomField () { 22 | [CmdletBinding( 23 | SupportsShouldProcess = $true, 24 | ConfirmImpact = "Low" 25 | )] 26 | 27 | Param( 28 | [parameter(mandatory = $true,ValueFromPipelineByPropertyName)] 29 | [int[]]$id, 30 | 31 | [parameter(mandatory = $false)] 32 | [string]$url, 33 | 34 | [parameter(mandatory = $false)] 35 | [string]$apiKey 36 | ) 37 | begin { 38 | } 39 | process { 40 | foreach($field_id in $id) { 41 | $Parameters = @{ 42 | Api = "/api/v1/fields/$field_id" 43 | Method = 'Delete' 44 | } 45 | 46 | if ($PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 47 | Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead." 48 | Set-SnipeitPSLegacyApiKey -apiKey $apikey 49 | } 50 | 51 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url) { 52 | Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." 53 | Set-SnipeitPSLegacyUrl -url $url 54 | } 55 | 56 | if ($PSCmdlet.ShouldProcess("ShouldProcess?")) { 57 | $result = Invoke-SnipeitMethod @Parameters 58 | } 59 | 60 | $result 61 | } 62 | } 63 | 64 | end { 65 | # reset legacy sessions 66 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url -or $PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 67 | Reset-SnipeitPSLegacyApi 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /SnipeitPS/Public/Remove-SnipeitDepartment.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Removes department from Snipe-it asset system 4 | .DESCRIPTION 5 | Removes department or multiple departments from Snipe-it asset system 6 | .PARAMETER ID 7 | Unique ID For department to be removed 8 | .PARAMETER url 9 | Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system. 10 | 11 | .PARAMETER apiKey 12 | Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit. 13 | 14 | .EXAMPLE 15 | Remove-SnipeitDepartment -ID 44 16 | 17 | .EXAMPLE 18 | Get-SnipeitDepartment | Where-object {$_.name -like '*head*'} | Remove-SnipeitDepartment 19 | #> 20 | 21 | function Remove-SnipeitDepartment () { 22 | [CmdletBinding( 23 | SupportsShouldProcess = $true, 24 | ConfirmImpact = "Low" 25 | )] 26 | 27 | Param( 28 | [parameter(mandatory = $true,ValueFromPipelineByPropertyName)] 29 | [int[]]$id, 30 | 31 | [parameter(mandatory = $false)] 32 | [string]$url, 33 | 34 | [parameter(mandatory = $false)] 35 | [string]$apiKey 36 | 37 | ) 38 | begin { 39 | } 40 | process { 41 | foreach($department_id in $id) { 42 | $Parameters = @{ 43 | Api = "/api/v1/departments/$department_id" 44 | Method = 'Delete' 45 | } 46 | 47 | if ($PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 48 | Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead." 49 | Set-SnipeitPSLegacyApiKey -apiKey $apikey 50 | } 51 | 52 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url) { 53 | Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." 54 | Set-SnipeitPSLegacyUrl -url $url 55 | } 56 | 57 | if ($PSCmdlet.ShouldProcess("ShouldProcess?")) { 58 | $result = Invoke-SnipeitMethod @Parameters 59 | } 60 | 61 | $result 62 | } 63 | } 64 | 65 | end { 66 | # reset legacy sessions 67 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url -or $PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 68 | Reset-SnipeitPSLegacyApi 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /SnipeitPS/Public/Remove-SnipeitLicense.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Removes licence from Snipe-it asset system 4 | .DESCRIPTION 5 | Removes licence or multiple licenses from Snipe-it asset system 6 | .PARAMETER ID 7 | Unique ID For licence to be removed 8 | .PARAMETER url 9 | Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system. 10 | 11 | .PARAMETER apiKey 12 | Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit. 13 | 14 | .EXAMPLE 15 | Remove-SnipeitLicence -ID 44 16 | 17 | .EXAMPLE 18 | Get-SnipeitLicence -product_key 123456789 | Remove-SnipeitLicense 19 | #> 20 | 21 | function Remove-SnipeitLicense () { 22 | [CmdletBinding( 23 | SupportsShouldProcess = $true, 24 | ConfirmImpact = "Low" 25 | )] 26 | 27 | Param( 28 | [parameter(mandatory = $true,ValueFromPipelineByPropertyName)] 29 | [int[]]$id, 30 | 31 | [parameter(mandatory = $false)] 32 | [string]$url, 33 | 34 | [parameter(mandatory = $false)] 35 | [string]$apiKey 36 | ) 37 | 38 | begin { 39 | } 40 | 41 | process { 42 | foreach($license_id in $id) { 43 | $Parameters = @{ 44 | Api = "/api/v1/licenses/$license_id" 45 | Method = 'Delete' 46 | } 47 | 48 | if ($PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 49 | Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead." 50 | Set-SnipeitPSLegacyApiKey -apiKey $apikey 51 | } 52 | 53 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url) { 54 | Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." 55 | Set-SnipeitPSLegacyUrl -url $url 56 | } 57 | 58 | if ($PSCmdlet.ShouldProcess("ShouldProcess?")) { 59 | $result = Invoke-SnipeitMethod @Parameters 60 | } 61 | 62 | $result 63 | } 64 | } 65 | 66 | end { 67 | # reset legacy sessions 68 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url -or $PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 69 | Reset-SnipeitPSLegacyApi 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /SnipeitPS/Public/Remove-SnipeitLocation.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Removes Location from Snipe-it asset system 4 | .DESCRIPTION 5 | Removes localtion or multiple locations from Snipe-it asset system 6 | .PARAMETER ID 7 | Unique ID For location to be removed 8 | .PARAMETER url 9 | Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system. 10 | 11 | .PARAMETER apiKey 12 | Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit. 13 | 14 | .EXAMPLE 15 | Remove-SnipeitLocation -ID 44 16 | 17 | .EXAMPLE 18 | Get-SnipeitLocation -city Arkham | Remove-SnipeitLocation 19 | #> 20 | 21 | function Remove-SnipeitLocation () { 22 | [CmdletBinding( 23 | SupportsShouldProcess = $true, 24 | ConfirmImpact = "Low" 25 | )] 26 | 27 | Param( 28 | [parameter(mandatory = $true,ValueFromPipelineByPropertyName)] 29 | [int[]]$id, 30 | 31 | [parameter(mandatory = $false)] 32 | [string]$url, 33 | 34 | [parameter(mandatory = $false)] 35 | [string]$apiKey 36 | ) 37 | 38 | begin { 39 | } 40 | 41 | process { 42 | foreach($location_id in $id) { 43 | $Parameters = @{ 44 | Api = "/api/v1/locations/$asset_id" 45 | Method = 'Delete' 46 | } 47 | 48 | if ($PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 49 | Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead." 50 | Set-SnipeitPSLegacyApiKey -apiKey $apikey 51 | } 52 | 53 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url) { 54 | Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." 55 | Set-SnipeitPSLegacyUrl -url $url 56 | } 57 | 58 | if ($PSCmdlet.ShouldProcess("ShouldProcess?")) { 59 | $result = Invoke-SnipeitMethod @Parameters 60 | } 61 | 62 | $result 63 | } 64 | } 65 | 66 | end { 67 | # reset legacy sessions 68 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url -or $PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 69 | Reset-SnipeitPSLegacyApi 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /SnipeitPS/Public/Remove-SnipeitManufacturer.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Removes manufacturer from Snipe-it asset system 4 | .DESCRIPTION 5 | Removes manufacturer or multiple manufacturers from Snipe-it asset system 6 | .PARAMETER ID 7 | Unique ID For manufacturer to be removed 8 | .PARAMETER url 9 | Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system. 10 | 11 | .PARAMETER apiKey 12 | Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit. 13 | 14 | .EXAMPLE 15 | Remove-SnipeitManufacturer -ID 44 16 | 17 | .EXAMPLE 18 | Get-SnipeitManufacturer | Where-object {$_.name -like '*something*'} | Remove-SnipeitManufacturer 19 | #> 20 | 21 | function Remove-SnipeitManufacturer () { 22 | [CmdletBinding( 23 | SupportsShouldProcess = $true, 24 | ConfirmImpact = "Low" 25 | )] 26 | 27 | Param( 28 | [parameter(mandatory = $true,ValueFromPipelineByPropertyName)] 29 | [int[]]$id, 30 | 31 | [parameter(mandatory = $false)] 32 | [string]$url, 33 | 34 | [parameter(mandatory = $false)] 35 | [string]$apiKey 36 | ) 37 | 38 | begin { 39 | } 40 | 41 | process { 42 | foreach($manufacturer_id in $id) { 43 | $Parameters = @{ 44 | Api = "/api/v1/manufacturers/$manufacturer_id" 45 | Method = 'Delete' 46 | } 47 | 48 | if ($PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 49 | Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead." 50 | Set-SnipeitPSLegacyApiKey -apiKey $apikey 51 | } 52 | 53 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url) { 54 | Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." 55 | Set-SnipeitPSLegacyUrl -url $url 56 | } 57 | 58 | if ($PSCmdlet.ShouldProcess("ShouldProcess?")) { 59 | $result = Invoke-SnipeitMethod @Parameters 60 | } 61 | 62 | $result 63 | } 64 | 65 | } 66 | 67 | end { 68 | # reset legacy sessions 69 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url -or $PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 70 | Reset-SnipeitPSLegacyApi 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /SnipeitPS/Public/Remove-SnipeitModel.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Removes Asset model from Snipe-it asset system 4 | .DESCRIPTION 5 | Removes asset model or multiple assets models from Snipe-it asset system 6 | .PARAMETER ID 7 | Unique ID For Model to be removed 8 | .PARAMETER url 9 | Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system. 10 | 11 | .PARAMETER apiKey 12 | Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit. 13 | 14 | .EXAMPLE 15 | Remove-SnipeitModel -ID 44 16 | 17 | .EXAMPLE 18 | Get-SnipeitModel -search needle | Remove-SnipeitModel 19 | #> 20 | 21 | function Remove-SnipeitModel () { 22 | [CmdletBinding( 23 | SupportsShouldProcess = $true, 24 | ConfirmImpact = "Low" 25 | )] 26 | 27 | Param( 28 | [parameter(mandatory = $true,ValueFromPipelineByPropertyName)] 29 | [int[]]$id, 30 | 31 | [parameter(mandatory = $false)] 32 | [string]$url, 33 | 34 | [parameter(mandatory = $false)] 35 | [string]$apiKey 36 | ) 37 | 38 | begin { 39 | } 40 | 41 | process { 42 | foreach($model_id in $id) { 43 | $Parameters = @{ 44 | Api = "/api/v1/models/$model_id" 45 | Method = 'Delete' 46 | } 47 | 48 | if ($PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 49 | Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead." 50 | Set-SnipeitPSLegacyApiKey -apiKey $apikey 51 | } 52 | 53 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url) { 54 | Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." 55 | Set-SnipeitPSLegacyUrl -url $url 56 | } 57 | 58 | if ($PSCmdlet.ShouldProcess("ShouldProcess?")) { 59 | $result = Invoke-SnipeitMethod @Parameters 60 | } 61 | 62 | $result 63 | } 64 | } 65 | 66 | end { 67 | # reset legacy sessions 68 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url -or $PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 69 | Reset-SnipeitPSLegacyApi 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /SnipeitPS/Public/Remove-SnipeitSupplier.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Removes supplier from Snipe-it asset system 4 | .DESCRIPTION 5 | Removes supplier or multiple manufacturers from Snipe-it asset system 6 | .PARAMETER ID 7 | Unique ID For supplier to be removed 8 | .PARAMETER url 9 | Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system. 10 | 11 | .PARAMETER apiKey 12 | Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit. 13 | 14 | .EXAMPLE 15 | Remove-SnipeitSupplier -ID 44 16 | 17 | .EXAMPLE 18 | Get-SnipeitSupplier | Where-object {$_.name -like '*something*'} | Remove-SnipeitSupplier 19 | #> 20 | 21 | function Remove-SnipeitSupplier () { 22 | [CmdletBinding( 23 | SupportsShouldProcess = $true, 24 | ConfirmImpact = "Low" 25 | )] 26 | 27 | Param( 28 | [parameter(mandatory = $true,ValueFromPipelineByPropertyName)] 29 | [int[]]$id, 30 | 31 | [parameter(mandatory = $false)] 32 | [string]$url, 33 | 34 | [parameter(mandatory = $false)] 35 | [string]$apiKey 36 | ) 37 | 38 | begin { 39 | } 40 | 41 | process { 42 | foreach($suppliers_id in $id) { 43 | $Parameters = @{ 44 | Api = "/api/v1/suppliers/$supplier_id" 45 | Method = 'Delete' 46 | } 47 | 48 | if ($PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 49 | Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead." 50 | Set-SnipeitPSLegacyApiKey -apiKey $apikey 51 | } 52 | 53 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url) { 54 | Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." 55 | Set-SnipeitPSLegacyUrl -url $url 56 | } 57 | 58 | if ($PSCmdlet.ShouldProcess("ShouldProcess?")) { 59 | $result = Invoke-SnipeitMethod @Parameters 60 | } 61 | 62 | $result 63 | } 64 | } 65 | 66 | end { 67 | # reset legacy sessions 68 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url -or $PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 69 | Reset-SnipeitPSLegacyApi 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /SnipeitPS/Public/Remove-SnipeitUser.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Removes User from Snipe-it asset system 4 | .DESCRIPTION 5 | Removes Uuser or users from Snipe-it asset system 6 | .PARAMETER ID 7 | Unique ID For User to be removed 8 | 9 | .PARAMETER url 10 | Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system. 11 | 12 | .PARAMETER apiKey 13 | Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit. 14 | 15 | .EXAMPLE 16 | Remove-SnipeitUser -ID 44 -url $url -apiKey $secret -Verbose 17 | #> 18 | 19 | function Remove-SnipeitUser () { 20 | [CmdletBinding( 21 | SupportsShouldProcess = $true, 22 | ConfirmImpact = "Low" 23 | )] 24 | 25 | Param( 26 | [parameter(mandatory = $true,ValueFromPipelineByPropertyName)] 27 | [int[]]$id, 28 | 29 | [parameter(mandatory = $false)] 30 | [string]$url, 31 | 32 | [parameter(mandatory = $false)] 33 | [string]$apiKey 34 | ) 35 | 36 | begin{ 37 | Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name 38 | } 39 | 40 | process { 41 | foreach($user_id in $id) { 42 | $Parameters = @{ 43 | Api = "/api/v1/users/$user_id" 44 | Method = 'Delete' 45 | } 46 | 47 | if ($PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 48 | Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead." 49 | Set-SnipeitPSLegacyApiKey -apiKey $apikey 50 | } 51 | 52 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url) { 53 | Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." 54 | Set-SnipeitPSLegacyUrl -url $url 55 | } 56 | 57 | if ($PSCmdlet.ShouldProcess("ShouldProcess?")) { 58 | $result = Invoke-SnipeitMethod @Parameters 59 | } 60 | 61 | $result 62 | } 63 | } 64 | 65 | end { 66 | # reset legacy sessions 67 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url -or $PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 68 | Reset-SnipeitPSLegacyApi 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /SnipeitPS/Public/Reset-SnipeitAccessoryOwner.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Checkin accessories 4 | 5 | .DESCRIPTION 6 | Checkin accessories 7 | 8 | .PARAMETER assigned_pivot_id 9 | This is the assigned_pivot_id of the accessory+user relationships in the accessories_users table 10 | Use Get-SnipeitAccessoryOwner to find out nooded value 11 | 12 | .PARAMETER url 13 | Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system. 14 | 15 | .PARAMETER apiKey 16 | Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit. 17 | 18 | .EXAMPLE 19 | To get the accessories_users table for specific accessory id number 20 | 21 | Get-SnipeitAccessoryOwner -id 1 22 | 23 | Thenselect assigned_pivot_id for userid you like check in 24 | 25 | Get-SnipeitAccessoryOwner -assigned_pivot_id xxx 26 | 27 | #> 28 | function Reset-SnipeitAccessoryOwner() { 29 | [CmdletBinding( 30 | SupportsShouldProcess = $true, 31 | ConfirmImpact = "Medium" 32 | )] 33 | 34 | Param( 35 | [parameter(mandatory = $true)] 36 | [int]$assigned_pivot_id, 37 | 38 | [parameter(mandatory = $false)] 39 | [string]$url, 40 | 41 | [parameter(mandatory = $false)] 42 | [string]$apiKey 43 | ) 44 | 45 | $Parameters = @{ 46 | Api = "/api/v1/accessories/$assigned_pivot_id/checkin" 47 | Method = 'Post' 48 | Body = @{} 49 | } 50 | 51 | if ($PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 52 | Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead." 53 | Set-SnipeitPSLegacyApiKey -apiKey $apikey 54 | } 55 | 56 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url) { 57 | Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." 58 | Set-SnipeitPSLegacyUrl -url $url 59 | } 60 | 61 | if ($PSCmdlet.ShouldProcess("ShouldProcess?")) { 62 | $result = Invoke-SnipeitMethod @Parameters 63 | } 64 | 65 | # reset legacy sessions 66 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url -or $PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 67 | Reset-SnipeitPSLegacyApi 68 | } 69 | 70 | return $result 71 | 72 | } 73 | -------------------------------------------------------------------------------- /SnipeitPS/Public/Reset-SnipeitAssetOwner.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Checkin asset 4 | .DESCRIPTION 5 | Checks asset in from current user/localtion/asset 6 | 7 | .PARAMETER ID 8 | Unique ID For asset to checkin 9 | 10 | .PARAMETER status_id 11 | Change asset status to 12 | 13 | .PARAMETER location_id 14 | Location id to change asset location to 15 | 16 | .PARAMETER note 17 | Notes about checkin 18 | 19 | .PARAMETER url 20 | Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system. 21 | .PARAMETER apiKey 22 | Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit. 23 | .EXAMPLE 24 | Remove-SnipeitUser -ID 44 25 | #> 26 | function Reset-SnipeitAssetOwner() { 27 | [CmdletBinding( 28 | SupportsShouldProcess = $true, 29 | ConfirmImpact = "Medium" 30 | )] 31 | 32 | Param( 33 | [parameter(mandatory = $true)] 34 | [int]$id, 35 | 36 | [int]$status_id, 37 | 38 | [int]$location_id, 39 | 40 | [string]$note, 41 | 42 | [parameter(mandatory = $false)] 43 | [string]$url, 44 | 45 | [parameter(mandatory = $false)] 46 | [string]$apiKey 47 | ) 48 | 49 | Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name 50 | 51 | $Values = @{ 52 | "note" = $note 53 | } 54 | 55 | if ($PSBoundParameters.ContainsKey('location_id')) { $Values.Add("location_id", $location_id) } 56 | if ($PSBoundParameters.ContainsKey('status_id')) { $Values.Add("status_id", $status_id) } 57 | 58 | $Parameters = @{ 59 | Api = "/api/v1/hardware/$id/checkin" 60 | Method = 'POST' 61 | Body = $Values 62 | } 63 | 64 | if ($PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 65 | Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead." 66 | Set-SnipeitPSLegacyApiKey -apiKey $apikey 67 | } 68 | 69 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url) { 70 | Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." 71 | Set-SnipeitPSLegacyUrl -url $url 72 | } 73 | 74 | if ($PSCmdlet.ShouldProcess("ShouldProcess?")) { 75 | $result = Invoke-SnipeitMethod @Parameters 76 | } 77 | 78 | # reset legacy sessions 79 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url -or $PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 80 | Reset-SnipeitPSLegacyApi 81 | } 82 | 83 | return $result 84 | } 85 | -------------------------------------------------------------------------------- /SnipeitPS/Public/Set-SnipeitAccessoryOwner.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Checkout accessory 4 | .DESCRIPTION 5 | Checkout accessory to user 6 | 7 | .PARAMETER id 8 | Unique ID For accessory or array of IDs to checkout 9 | 10 | .PARAMETER assigned_id 11 | Id of target user 12 | 13 | .PARAMETER note 14 | Notes about checkout 15 | 16 | .PARAMETER url 17 | Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system. 18 | 19 | .PARAMETER apiKey 20 | Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit. 21 | 22 | .EXAMPLE 23 | Set-SnipeitAccessoryOwner -id 1 -assigned_id 1 -note "testing check out to user" 24 | #> 25 | function Set-SnipeitAccessoryOwner() { 26 | [CmdletBinding( 27 | SupportsShouldProcess = $true, 28 | ConfirmImpact = "Medium" 29 | )] 30 | 31 | Param( 32 | [parameter(mandatory = $true,ValueFromPipelineByPropertyName)] 33 | [int[]]$id, 34 | 35 | [parameter(mandatory = $true)] 36 | [int]$assigned_to, 37 | 38 | [string] $note, 39 | 40 | [parameter(mandatory = $false)] 41 | [string]$url, 42 | 43 | [parameter(mandatory = $false)] 44 | [string]$apiKey 45 | ) 46 | begin{ 47 | $Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters 48 | } 49 | 50 | process { 51 | foreach($accessory_id in $id) { 52 | $Parameters = @{ 53 | Api = "/api/v1/accessories/$accessory_id/checkout" 54 | Method = 'POST' 55 | Body = $Values 56 | } 57 | 58 | if ($PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 59 | Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead." 60 | Set-SnipeitPSLegacyApiKey -apiKey $apikey 61 | } 62 | 63 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url) { 64 | Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." 65 | Set-SnipeitPSLegacyUrl -url $url 66 | } 67 | 68 | if ($PSCmdlet.ShouldProcess("ShouldProcess?")) { 69 | $result = Invoke-SnipeitMethod @Parameters 70 | } 71 | 72 | return $result 73 | } 74 | } 75 | 76 | end { 77 | # reset legacy sessions 78 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url -or $PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 79 | Reset-SnipeitPSLegacyApi 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /SnipeitPS/Public/Set-SnipeitCompany.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Updates company name 4 | 5 | .DESCRIPTION 6 | Updates companyt name on Snipe-It system 7 | 8 | .PARAMETER id 9 | ID number of company 10 | 11 | .PARAMETER name 12 | Company name 13 | 14 | .PARAMETER image 15 | Image file name and path for item 16 | 17 | .PARAMETER image_delete 18 | Remove current image 19 | 20 | .PARAMETER RequestType 21 | Http request type to send Snipe IT system. Defaults to Patch you could use Put if needed. 22 | 23 | .PARAMETER url 24 | Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system. 25 | 26 | .PARAMETER apiKey 27 | Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key API Key for Snipeit. 28 | 29 | .EXAMPLE 30 | An example 31 | 32 | .NOTES 33 | General notes 34 | #> 35 | function Set-SnipeitCompany() { 36 | [CmdletBinding( 37 | SupportsShouldProcess = $true, 38 | ConfirmImpact = "Medium" 39 | )] 40 | 41 | Param( 42 | [parameter(mandatory = $true,ValueFromPipelineByPropertyName)] 43 | [int[]]$id, 44 | 45 | [parameter(mandatory = $true)] 46 | [string]$name, 47 | 48 | [ValidateScript({Test-Path $_})] 49 | [string]$image, 50 | 51 | [switch]$image_delete=$false, 52 | 53 | [ValidateSet("Put","Patch")] 54 | [string]$RequestType = "Patch", 55 | 56 | [parameter(mandatory = $false)] 57 | [string]$url, 58 | 59 | [parameter(mandatory = $false)] 60 | [string]$apiKey 61 | ) 62 | 63 | begin{ 64 | $Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters 65 | } 66 | 67 | process{ 68 | foreach($company_id in $id) { 69 | $Parameters = @{ 70 | Api = "/api/v1/companies/$company_id" 71 | Method = $RequestType 72 | Body = $Values 73 | } 74 | 75 | if ($PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 76 | Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead." 77 | Set-SnipeitPSLegacyApiKey -apiKey $apikey 78 | } 79 | 80 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url) { 81 | Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." 82 | Set-SnipeitPSLegacyUrl -url $url 83 | } 84 | 85 | if ($PSCmdlet.ShouldProcess("ShouldProcess?")) { 86 | $result = Invoke-SnipeitMethod @Parameters 87 | } 88 | 89 | $result 90 | } 91 | } 92 | end { 93 | # reset legacy sessions 94 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url -or $PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 95 | Reset-SnipeitPSLegacyApi 96 | } 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /SnipeitPS/Public/Set-SnipeitDepartment.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Updates a department 4 | 5 | .DESCRIPTION 6 | Updates the department on Snipe-It system 7 | 8 | .PARAMETER id 9 | Id number of Department 10 | 11 | .PARAMETER name 12 | Department Name 13 | 14 | .PARAMETER company_id 15 | ID number of company 16 | 17 | .PARAMETER location_id 18 | ID number of location 19 | 20 | .PARAMETER manager_id 21 | ID number of manager 22 | 23 | .PARAMETER image 24 | Image file name and path for item 25 | 26 | .PARAMETER image_delete 27 | Remove current image 28 | 29 | .PARAMETER RequestType 30 | Http request type to send Snipe IT system. Defaults to Patch you could use Put if needed. 31 | 32 | .PARAMETER url 33 | Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system. 34 | 35 | .PARAMETER apiKey 36 | Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit. 37 | 38 | .EXAMPLE 39 | Set-SnipeitDepartment -id 4 -manager_id 3 40 | 41 | #> 42 | 43 | function Set-SnipeitDepartment() { 44 | [CmdletBinding( 45 | SupportsShouldProcess = $true, 46 | ConfirmImpact = "Low" 47 | )] 48 | 49 | Param( 50 | [parameter(mandatory = $true,ValueFromPipelineByPropertyName)] 51 | [int[]]$id, 52 | 53 | [string]$name, 54 | 55 | [Nullable[System.Int32]]$company_id, 56 | 57 | [Nullable[System.Int32]]$location_id, 58 | 59 | [Nullable[System.Int32]]$manager_id, 60 | 61 | [string]$notes, 62 | 63 | [ValidateScript({Test-Path $_})] 64 | [string]$image, 65 | 66 | [switch]$image_delete=$false, 67 | 68 | [ValidateSet("Put","Patch")] 69 | [string]$RequestType = "Patch", 70 | 71 | [parameter(mandatory = $false)] 72 | [string]$url, 73 | 74 | [parameter(mandatory = $false)] 75 | [string]$apiKey 76 | ) 77 | 78 | begin { 79 | 80 | $Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters 81 | } 82 | 83 | process { 84 | foreach ($department_id in $id) { 85 | $Parameters = @{ 86 | Api = "/api/v1/departments/$department_id" 87 | Method = $RequestType 88 | Body = $Values 89 | } 90 | 91 | if ($PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 92 | Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead." 93 | Set-SnipeitPSLegacyApiKey -apiKey $apikey 94 | } 95 | 96 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url) { 97 | Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." 98 | Set-SnipeitPSLegacyUrl -url $url 99 | } 100 | 101 | if ($PSCmdlet.ShouldProcess("ShouldProcess?")) { 102 | $result = Invoke-SnipeitMethod @Parameters 103 | } 104 | 105 | $result 106 | } 107 | } 108 | end { 109 | # reset legacy sessions 110 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url -or $PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 111 | Reset-SnipeitPSLegacyApi 112 | } 113 | } 114 | } 115 | 116 | -------------------------------------------------------------------------------- /SnipeitPS/Public/Set-SnipeitInfo.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Sets authetication information. Deprecated, use Connect-SnipeitPS instead. 4 | 5 | .DESCRIPTION 6 | Deprecated combatibilty function that Set apikey and url user to connect Snipe-It system. 7 | Please use Connect-SnipeitPS instead. 8 | 9 | .PARAMETER url 10 | URL of Snipeit system. 11 | 12 | .PARAMETER apiKey 13 | User's API Key for Snipeit. 14 | 15 | .EXAMPLE 16 | Set-SnipeitInfo -url $url -apiKey -Verbose 17 | #> 18 | function Set-SnipeitInfo { 19 | [CmdletBinding()] 20 | [System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseShouldProcessForStateChangingFunctions', '')] 21 | param ( 22 | [parameter(Mandatory=$true)] 23 | [Uri]$url, 24 | [parameter(Mandatory=$true)] 25 | [String]$apiKey 26 | ) 27 | 28 | BEGIN { 29 | 30 | Write-Warning "Deprecated $($MyInvocation.InvocationName) is still working, please use Connect-SnipeitPS instead." 31 | } 32 | 33 | PROCESS { 34 | Connect-SnipeitPS -Url $url -apiKey $apiKey 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /SnipeitPS/Public/Set-SnipeitLicenseSeat.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Set license seat or checkout license seat 4 | .DESCRIPTION 5 | Checkout specific license seat to user, asset or both 6 | 7 | .PARAMETER ID 8 | Unique ID For license to checkout or array of IDs 9 | 10 | .PARAMETER assigned_to 11 | Id of target user 12 | 13 | .PARAMETER asset_id 14 | Id of target asset 15 | 16 | .PARAMETER note 17 | Notes about checkout 18 | 19 | .PARAMETER RequestType 20 | Http request type to send Snipe IT system. Defaults to Patch you could use Put if needed. 21 | 22 | .PARAMETER url 23 | Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system. 24 | 25 | .PARAMETER apiKey 26 | Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit. 27 | 28 | .EXAMPLE 29 | Set-SnipeitLicenceSeat -ID 1 -seat_id 1 -assigned_id 3 30 | Checkout licence to user id 3 31 | 32 | .EXAMPLE 33 | Set-SnipeitLicenceSeat -ID 1 -seat_id 1 -asset_id 3 34 | Checkout licence to asset id 3 35 | 36 | .EXAMPLE 37 | Set-SnipeitLicenceSeat -ID 1 -seat_id 1 -asset_id $null -assigned_id $null 38 | Checkin licence seat id 1 of licence id 1 39 | 40 | #> 41 | function Set-SnipeitLicenseSeat() { 42 | [CmdletBinding( 43 | SupportsShouldProcess = $true, 44 | ConfirmImpact = "Medium" 45 | )] 46 | 47 | Param( 48 | [parameter(mandatory = $true)] 49 | [int[]]$id, 50 | 51 | [parameter(mandatory = $true)] 52 | [int]$seat_id, 53 | 54 | [Alias('assigned_id')] 55 | 56 | [Nullable[System.Int32]]$assigned_to, 57 | 58 | 59 | [Nullable[System.Int32]]$asset_id, 60 | 61 | [string]$note, 62 | 63 | [ValidateSet("Put","Patch")] 64 | [string]$RequestType = "Patch", 65 | 66 | [parameter(mandatory = $false)] 67 | [string]$url, 68 | 69 | [parameter(mandatory = $false)] 70 | [string]$apiKey 71 | ) 72 | 73 | begin{ 74 | $Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters 75 | } 76 | 77 | process{ 78 | foreach($license_id in $id) { 79 | $Parameters = @{ 80 | Api = "/api/v1/licenses/$license_id/seats/$seat_id" 81 | Method = $RequestType 82 | Body = $Values 83 | } 84 | 85 | if ($PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 86 | Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead." 87 | Set-SnipeitPSLegacyApiKey -apiKey $apikey 88 | } 89 | 90 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url) { 91 | Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." 92 | Set-SnipeitPSLegacyUrl -url $url 93 | } 94 | 95 | if ($PSCmdlet.ShouldProcess("ShouldProcess?")) { 96 | $result = Invoke-SnipeitMethod @Parameters 97 | } 98 | 99 | return $result 100 | } 101 | 102 | end { 103 | # reset legacy sessions 104 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url -or $PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 105 | Reset-SnipeitPSLegacyApi 106 | } 107 | } 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /SnipeitPS/Public/Set-SnipeitManufacturer.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Add a new Manufacturer to Snipe-it asset system 4 | 5 | .DESCRIPTION 6 | Long description 7 | 8 | .PARAMETER Name 9 | Name of the Manufacturer 10 | 11 | .PARAMETER image 12 | Image file name and path for item 13 | 14 | .PARAMETER image_delete 15 | Remove current image 16 | 17 | .PARAMETER RequestType 18 | Http request type to send Snipe IT system. Defaults to Patch you could use Put if needed. 19 | 20 | .PARAMETER url 21 | Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system. 22 | 23 | .PARAMETER apiKey 24 | Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit. 25 | 26 | .EXAMPLE 27 | New-SnipeitManufacturer -name "HP" 28 | #> 29 | 30 | function Set-SnipeitManufacturer() { 31 | [CmdletBinding( 32 | SupportsShouldProcess = $true, 33 | ConfirmImpact = "Low" 34 | )] 35 | 36 | Param( 37 | [parameter(mandatory = $true)] 38 | [string]$Name, 39 | 40 | [ValidateScript({Test-Path $_})] 41 | [string]$image, 42 | 43 | [switch]$image_delete=$false, 44 | 45 | [ValidateSet("Put","Patch")] 46 | [string]$RequestType = "Patch", 47 | 48 | [parameter(mandatory = $false)] 49 | [string]$url, 50 | 51 | [parameter(mandatory = $false)] 52 | [string]$apiKey 53 | ) 54 | 55 | begin{ 56 | Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name 57 | 58 | $Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters 59 | } 60 | 61 | process{ 62 | foreach ($manufacturer_id in $id) { 63 | $Parameters = @{ 64 | Api = "/api/v1/manufacturers/$manufacturer_id" 65 | Method = $RequestType 66 | Body = $Values 67 | } 68 | 69 | if ($PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 70 | Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead." 71 | Set-SnipeitPSLegacyApiKey -apiKey $apikey 72 | } 73 | 74 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url) { 75 | Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." 76 | Set-SnipeitPSLegacyUrl -url $url 77 | } 78 | 79 | if ($PSCmdlet.ShouldProcess("ShouldProcess?")) { 80 | $result = Invoke-SnipeitMethod @Parameters 81 | } 82 | 83 | $result 84 | } 85 | } 86 | 87 | end { 88 | # reset legacy sessions 89 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url -or $PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 90 | Reset-SnipeitPSLegacyApi 91 | } 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /SnipeitPS/Public/Set-SnipeitStatus.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Sets Snipe-it Status Labels 4 | 5 | .PARAMETER id 6 | A id of specific Status Label 7 | 8 | 9 | .PARAMETER color 10 | Hex code showing what color the status label should be on the pie chart in the dashboard 11 | 12 | .PARAMETER show_in_nav 13 | 1 or 0 - determine whether the status label should show in the left-side nav of the web GUI 14 | 15 | .PARAMETER default_label 16 | 1 or 0 - determine whether it should be bubbled up to the top of the list of available statuses 17 | 18 | .PARAMETER RequestType 19 | Http request type to send Snipe IT system. Defaults to Patch you could use Put if needed. 20 | 21 | .PARAMETER url 22 | Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system. 23 | 24 | .PARAMETER apiKey 25 | Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit. 26 | 27 | .EXAMPLE 28 | Get-SnipeitStatus -search "Ready to Deploy" 29 | 30 | .EXAMPLE 31 | Set-SnipeitStatus -id 3 -name 'Waiting for arrival' -type pending 32 | 33 | #> 34 | 35 | function Set-SnipeitStatus() { 36 | [CmdletBinding( 37 | SupportsShouldProcess = $true, 38 | ConfirmImpact = "Medium" 39 | )] 40 | Param( 41 | [parameter(Mandatory=$true,ValueFromPipelineByPropertyName)] 42 | [int[]]$id, 43 | 44 | [string]$name, 45 | 46 | [parameter(Mandatory=$true)] 47 | [ValidateSet('deployable','undeployable','pending','archived')] 48 | [string]$type, 49 | 50 | [string]$notes, 51 | 52 | [string]$color, 53 | 54 | [bool]$show_in_nav, 55 | 56 | [bool]$default_label, 57 | 58 | [ValidateSet("Put","Patch")] 59 | [string]$RequestType = "Patch", 60 | 61 | [parameter(mandatory = $false)] 62 | [string]$url, 63 | 64 | [parameter(mandatory = $false)] 65 | [string]$apiKey 66 | ) 67 | 68 | begin { 69 | $Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters 70 | } 71 | 72 | process { 73 | foreach($status_id in $id) { 74 | $Parameters = @{ 75 | Api = "/api/v1/statuslabels/$status_id" 76 | Method = $RequestType 77 | Body = $Values 78 | } 79 | 80 | if ($PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 81 | Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead." 82 | Set-SnipeitPSLegacyApiKey -apiKey $apikey 83 | } 84 | 85 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url) { 86 | Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." 87 | Set-SnipeitPSLegacyUrl -url $url 88 | } 89 | 90 | if ($PSCmdlet.ShouldProcess("ShouldProcess?")) { 91 | $result = Invoke-SnipeitMethod @Parameters 92 | } 93 | $result 94 | } 95 | } 96 | 97 | end { 98 | # reset legacy sessions 99 | if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url -or $PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) { 100 | Reset-SnipeitPSLegacyApi 101 | } 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /SnipeitPS/Public/Update-SnipeitAlias.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Replaces old SnipeitPS commands with new ones 4 | 5 | .DESCRIPTION 6 | Replaces old SnipeitPS commands with new ones 7 | 8 | .PARAMETER String 9 | Input string 10 | 11 | .EXAMPLE 12 | Get-Content [your-script.ps1] | Update-SnipeitAlias | Out-File [new-script-name.ps1] 13 | 14 | Replaces old command from file "your-script.ps1" and creates new script "new-script-name.ps1" 15 | After testing new file you can replace old file with new. 16 | 17 | #> 18 | function Update-SnipeitAlias() { 19 | [CmdletBinding( 20 | SupportsShouldProcess = $true, 21 | ConfirmImpact = "Low" 22 | )] 23 | param( 24 | [Parameter(Mandatory = $true, 25 | ValueFromPipeline = $true)] 26 | 27 | [string[]] 28 | $String 29 | ) 30 | begin{ 31 | Write-Verbose "Replacing old Snipeit fuctions with new ones.. " 32 | $SnipeitAliases = Get-SnipeitAlias 33 | 34 | } 35 | process { 36 | if ($PSCmdlet.ShouldProcess("ShouldProcess?")) { 37 | ForEach ($st in $String) { 38 | $result = $st 39 | ForEach ($key in $SnipeitAliases.Keys ) { 40 | #Write-Verbose "Replacing $key with $($SnipeitAliases[$key])" 41 | $result = $result -replace $key, $SnipeitAliases[$key] 42 | } 43 | $result 44 | } 45 | } 46 | } 47 | end{ 48 | Write-Verbose "..replacing done" 49 | } 50 | 51 | 52 | 53 | } 54 | -------------------------------------------------------------------------------- /SnipeitPS/SnipeitPS.psm1: -------------------------------------------------------------------------------- 1 | <# 2 | .DESCRIPTION 3 | Powershell API for Snipeit Asset Management 4 | #> 5 | $scriptRoot = $PSScriptRoot + '\Public' 6 | 7 | Get-ChildItem $scriptRoot *.ps1 | ForEach-Object { 8 | . $_.FullName 9 | } 10 | 11 | $scriptRoot = $PSScriptRoot + '\Private' 12 | 13 | Get-ChildItem $scriptRoot *.ps1 | ForEach-Object { 14 | . $_.FullName 15 | } 16 | 17 | #Create unprefixed aliases 18 | Set-SnipeitAlias 19 | 20 | #Session variable for storing current session information 21 | $SnipeitPSSession = [ordered]@{ 22 | 'url' = $null 23 | 'apiKey' = $null 24 | } 25 | New-Variable -Name SnipeitPSSession -Value $SnipeitPSSession -Scope Script -Force 26 | 27 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-cayman -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | ############################################################ 2 | # 3 | # See http://www.appveyor.com/docs/appveyor-yml for many more options 4 | # 5 | # Credit for a lot of this file goes to RamblingCookieMonster: 6 | # https://github.com/RamblingCookieMonster/PSSQLite/blob/master/appveyor.yml 7 | # 8 | ############################################################ 9 | 10 | # powershell core and 5.1 11 | image: 12 | - Visual Studio 2017 13 | - Visual Studio 2019 14 | 15 | environment: 16 | PSGalleryAPIKey: 17 | secure: UdM6qhf5B0G8liHhUrwWERCZr44iSqmg4jUq0lwlTjZs4KyeoiwnBzdej0phqIAm 18 | PShell: '5' 19 | 20 | version: 1.10.{build} 21 | 22 | # Don't rebuild when I tag a release on GitHub 23 | skip_tags: true 24 | 25 | # Ignore testing a commit if only the readme changed 26 | # Or if I include "skip-tests" in the commit message 27 | skip_commits: 28 | message: /skip\-tests/ 29 | files: 30 | - .github/ 31 | - .vscode/ 32 | - assets/ 33 | - Tools/ 34 | - README.md 35 | - .gitattributes 36 | - .gitignore 37 | 38 | # PRs, by definition, don't change anything and therefore should not increment the version 39 | # To be fair, this is not important, and is really just AppVeyor enabling my pedantry 40 | pull_requests: 41 | do_not_increment_build_number: true 42 | 43 | install: 44 | - ps: | 45 | Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force | Out-Null 46 | Install-Module InvokeBuild -Scope CurrentUser -Force 47 | Install-Module BuildHelpers -Scope CurrentUser -Force 48 | Install-Module platyPS -Scope CurrentUser -Force 49 | Install-Module Pester -Scope CurrentUser -Force 50 | Install-Module PSScriptAnalyzer -Scope CurrentUser -Force 51 | $env:releasePath = "$($pwd.Path)\Release" 52 | 53 | before_build: 54 | - ps: Invoke-Build -Task ShowDebug 55 | 56 | build_script: 57 | - ps: Invoke-Build -Task Build 58 | 59 | test_script: 60 | - ps: Invoke-Build -Task Test 61 | 62 | before_deploy: 63 | - ps: Invoke-Build -Task Deploy 64 | 65 | #Build with powershell core 66 | for: 67 | - 68 | matrix: 69 | only: 70 | - image: Visual Studio 2019 71 | environment: 72 | PShell: '7' 73 | install: 74 | - pwsh: | 75 | Install-Module InvokeBuild -Scope CurrentUser -Force 76 | Install-Module BuildHelpers -Scope CurrentUser -Force 77 | Install-Module platyPS -Scope CurrentUser -Force 78 | Install-Module Pester -Scope CurrentUser -Force 79 | Install-Module PSScriptAnalyzer -Scope CurrentUser -Force 80 | $env:releasePath = "$($pwd.Path)\Release" 81 | before_build: 82 | - pwsh: Invoke-Build -Task ShowDebug 83 | build_script: 84 | - pwsh: Invoke-Build -Task Build 85 | 86 | test_script: 87 | - pwsh: Invoke-Build -Task Test 88 | 89 | before_deploy: 90 | - pwsh: Invoke-Build -Task Deploy 91 | 92 | 93 | deploy: 94 | provider: GitHub 95 | release: v$(appveyor_build_version) 96 | description: '' 97 | auth_token: 98 | secure: m72Ke3nJcSxZkc36UwRIw+q0NtNvERfQYHZUBNDvLP/kjW+mWmVueR6tmgBujyBM 99 | draft: false 100 | prerelease: false 101 | on: 102 | branch: master # release from master branch only 103 | appveyor_repo_tag: false # deploy on tag push only 104 | -------------------------------------------------------------------------------- /build.ps1: -------------------------------------------------------------------------------- 1 | param( 2 | [string[]]$Tasks 3 | ) 4 | 5 | 6 | 7 | function Install-Dependency([string] $Name) 8 | { 9 | $policy = Get-PSRepository -Name "PSGallery" | Select-Object -ExpandProperty "InstallationPolicy" 10 | if($policy -ne "Trusted") { 11 | Set-PSRepository -Name "PSGallery" -InstallationPolicy Trusted 12 | } 13 | 14 | if (!(Get-Module -Name $Name -ListAvailable)) { 15 | Install-Module -Name $Name -Scope CurrentUser 16 | } 17 | } 18 | 19 | function Run-Tests 20 | { 21 | param( 22 | [string]$Path = "$PSScriptRoot\SnipeitPS" 23 | ) 24 | 25 | $results = Invoke-Pester -PassThru 26 | if($results.FailedCount -gt 0) { 27 | Write-Output " > $($results.FailedCount) tests failed. The build cannot continue." 28 | foreach($result in $($results.TestResult | Where {$_.Passed -eq $false} | Select-Object -Property Describe,Context,Name,Passed,Time)){ 29 | Write-Output " > $result" 30 | } 31 | 32 | EXIT 1 33 | } 34 | } 35 | 36 | function Release 37 | { 38 | Write-Output "Setting Variables" 39 | $BuildRoot = $env:CI_PROJECT_DIR 40 | $releasePath = "$BuildRoot\Release" 41 | 42 | Write-Output "Build Root : $BuildRoot" 43 | Write-Output "Release Root : $releasePath" 44 | 45 | if (-not (Test-Path "$releasePath\SnipeitPS")) { 46 | $null = New-Item -Path "$releasePath\SnipeitPS" -ItemType Directory 47 | } 48 | 49 | # Copy module 50 | Copy-Item -Path "$BuildRoot\SnipeitPS\*" -Destination "$releasePath\SnipeitPS" -Recurse -Force 51 | # Copy additional files 52 | $additionalFiles = @( 53 | "$BuildRoot\CHANGELOG.md" 54 | "$BuildRoot\LICENSE" 55 | "$BuildRoot\README.md" 56 | ) 57 | Copy-Item -Path $additionalFiles -Destination "$releasePath\SnipeitPS" -Force 58 | 59 | 60 | $manifestContent = Get-Content -Path "$releasePath\SnipeitPS\SnipeitPS.psd1" -Raw 61 | if ($manifestContent -notmatch '(?<=ModuleVersion\s+=\s+'')(?.*)(?='')') { 62 | throw "Module version was not found in manifest file," 63 | } 64 | 65 | $currentVersion = [Version] $Matches.ModuleVersion 66 | if ($env:CI_JOB_ID) { 67 | $newRevision = $env:CI_JOB_ID 68 | } 69 | else { 70 | $newRevision = 0 71 | } 72 | $version = New-Object -TypeName System.Version -ArgumentList $currentVersion.Major, 73 | $currentVersion.Minor, 74 | $newRevision 75 | 76 | Write-Output "New version : $version" 77 | 78 | Update-Metadata -Path "$releasePath\SnipeitPS\SnipeitPS.psd1" -PropertyName ModuleVersion -Value $version 79 | $functionsToExport = Get-ChildItem "$BuildRoot\SnipeitPS\Public" | ForEach-Object {$_.BaseName} 80 | Set-ModuleFunctions -Name "$releasePath\SnipeitPS\SnipeitPS.psd1" -FunctionsToExport $functionsToExport 81 | 82 | #Remove-Module SnipeitPS 83 | Import-Module $env:CI_PROJECT_DIR\SnipeitPS\SnipeitPS.psd1 -force -ErrorAction Stop 84 | Publish-Module -Name SnipeitPS -Repository InternalPowerShellModules -NuGetApiKey 123456789 85 | } 86 | 87 | foreach($task in $Tasks){ 88 | switch($task) 89 | { 90 | "test" { 91 | Install-Dependency -Name "PSScriptAnalyzer" 92 | Install-Dependency -Name "Pester" 93 | Write-Output "Running Pester Tests..." 94 | Run-Tests 95 | } 96 | "release" { 97 | Write-Output "Releasing..." 98 | Release 99 | } 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /docs/Connect-SnipeitPS.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: SnipeitPS-help.xml 3 | Module Name: SnipeitPS 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Connect-SnipeitPS 9 | 10 | ## SYNOPSIS 11 | Sets authetication information 12 | 13 | ## SYNTAX 14 | 15 | ### Connect with url and apikey (Default) 16 | ``` 17 | Connect-SnipeitPS -url -apiKey [] 18 | ``` 19 | 20 | ### Connect with url and secure apikey 21 | ``` 22 | Connect-SnipeitPS -url -secureApiKey [] 23 | ``` 24 | 25 | ### Connect with credential 26 | ``` 27 | Connect-SnipeitPS -siteCred [] 28 | ``` 29 | 30 | ## DESCRIPTION 31 | Sets apikey and url to connect Snipe-It system. 32 | Based on Set-SnipeitInfo command, what is now just compatibility wrapper 33 | and calls Connect-SnipeitPS 34 | 35 | ## EXAMPLES 36 | 37 | ### EXAMPLE 1 38 | ``` 39 | Connect-SnipeitPS -Url $url -apiKey $myapikey 40 | Connect to Snipe it api. 41 | ``` 42 | 43 | ### EXAMPLE 2 44 | ``` 45 | Connect-SnipeitPS -Url $url -SecureApiKey $myapikey 46 | Connects to Snipe it api with apikey stored to securestring 47 | ``` 48 | 49 | ### EXAMPLE 3 50 | ``` 51 | Connect-SnipeitPS -siteCred (Get-Credential -message "Use site url as username and apikey as password") 52 | Connect to Snipe It with PSCredential object. 53 | To use saved creadentials yu can use export-clixml and import-clixml commandlets. 54 | ``` 55 | 56 | ### EXAMPLE 4 57 | ``` 58 | Build credential with apikey value from secret vault (Microsoft.PowerShell.SecretManagement) 59 | $siteurl = "https://mysnipeitsite.url" 60 | $apikey = Get-SecretInfo -Name SnipeItApiKey 61 | $siteCred = New-Object -Type PSCredential -Argumentlist $siteurl,$spikey 62 | Connect-SnipeitPS -siteCred $siteCred 63 | ``` 64 | 65 | ## PARAMETERS 66 | 67 | ### -apiKey 68 | User's API Key for Snipeit. 69 | 70 | ```yaml 71 | Type: String 72 | Parameter Sets: Connect with url and apikey 73 | Aliases: 74 | 75 | Required: True 76 | Position: Named 77 | Default value: None 78 | Accept pipeline input: False 79 | Accept wildcard characters: False 80 | ``` 81 | 82 | ### -secureApiKey 83 | Snipe it Api key as securestring 84 | 85 | ```yaml 86 | Type: SecureString 87 | Parameter Sets: Connect with url and secure apikey 88 | Aliases: 89 | 90 | Required: True 91 | Position: Named 92 | Default value: None 93 | Accept pipeline input: False 94 | Accept wildcard characters: False 95 | ``` 96 | 97 | ### -siteCred 98 | PSCredential where username shoul be snipe it url and password should be 99 | snipe it apikey. 100 | 101 | ```yaml 102 | Type: PSCredential 103 | Parameter Sets: Connect with credential 104 | Aliases: 105 | 106 | Required: True 107 | Position: Named 108 | Default value: None 109 | Accept pipeline input: False 110 | Accept wildcard characters: False 111 | ``` 112 | 113 | ### -url 114 | URL of Snipeit system. 115 | 116 | ```yaml 117 | Type: Uri 118 | Parameter Sets: Connect with url and apikey, Connect with url and secure apikey 119 | Aliases: 120 | 121 | Required: True 122 | Position: Named 123 | Default value: None 124 | Accept pipeline input: False 125 | Accept wildcard characters: False 126 | ``` 127 | 128 | ### CommonParameters 129 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 130 | 131 | ## INPUTS 132 | 133 | ## OUTPUTS 134 | 135 | ## NOTES 136 | 137 | ## RELATED LINKS 138 | -------------------------------------------------------------------------------- /docs/Get-SnipeitAccessoryOwner.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: SnipeitPS-help.xml 3 | Module Name: SnipeitPS 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-SnipeitAccessoryOwner 9 | 10 | ## SYNOPSIS 11 | Get list of checked out accessories 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Get-SnipeitAccessoryOwner [-id] [[-url] ] [[-apiKey] ] [-WhatIf] [-Confirm] 17 | [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | Get list of checked out accessories 22 | 23 | ## EXAMPLES 24 | 25 | ### EXAMPLE 1 26 | ``` 27 | Get-SnipeitAccessoryOwner -id 1 28 | ``` 29 | 30 | ## PARAMETERS 31 | 32 | ### -apiKey 33 | Deprecated parameter, please use Connect-SnipeitPS instead. 34 | User's API Key for Snipeit. 35 | 36 | ```yaml 37 | Type: String 38 | Parameter Sets: (All) 39 | Aliases: 40 | 41 | Required: False 42 | Position: 3 43 | Default value: None 44 | Accept pipeline input: False 45 | Accept wildcard characters: False 46 | ``` 47 | 48 | ### -id 49 | Unique ID For accessory to list 50 | 51 | ```yaml 52 | Type: Int32 53 | Parameter Sets: (All) 54 | Aliases: 55 | 56 | Required: True 57 | Position: 1 58 | Default value: 0 59 | Accept pipeline input: False 60 | Accept wildcard characters: False 61 | ``` 62 | 63 | ### -url 64 | Deprecated parameter, please use Connect-SnipeitPS instead. 65 | URL of Snipeit system. 66 | 67 | ```yaml 68 | Type: String 69 | Parameter Sets: (All) 70 | Aliases: 71 | 72 | Required: False 73 | Position: 2 74 | Default value: None 75 | Accept pipeline input: False 76 | Accept wildcard characters: False 77 | ``` 78 | 79 | ### -Confirm 80 | Prompts you for confirmation before running the cmdlet. 81 | 82 | ```yaml 83 | Type: SwitchParameter 84 | Parameter Sets: (All) 85 | Aliases: cf 86 | 87 | Required: False 88 | Position: Named 89 | Default value: None 90 | Accept pipeline input: False 91 | Accept wildcard characters: False 92 | ``` 93 | 94 | ### -WhatIf 95 | Shows what would happen if the cmdlet runs. 96 | The cmdlet is not run. 97 | 98 | ```yaml 99 | Type: SwitchParameter 100 | Parameter Sets: (All) 101 | Aliases: wi 102 | 103 | Required: False 104 | Position: Named 105 | Default value: None 106 | Accept pipeline input: False 107 | Accept wildcard characters: False 108 | ``` 109 | 110 | ### CommonParameters 111 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 112 | 113 | ## INPUTS 114 | 115 | ## OUTPUTS 116 | 117 | ## NOTES 118 | 119 | ## RELATED LINKS 120 | -------------------------------------------------------------------------------- /docs/Get-SnipeitCustomField.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: SnipeitPS-help.xml 3 | Module Name: SnipeitPS 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-SnipeitCustomField 9 | 10 | ## SYNOPSIS 11 | Returns specific Snipe-IT custom field or a list of all custom field 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Get-SnipeitCustomField [[-id] ] [[-url] ] [[-apiKey] ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | {{ Fill in the Description }} 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | Get-SnipeitCustomField 27 | Get all custom fields 28 | ``` 29 | 30 | ### EXAMPLE 2 31 | ``` 32 | Get-SnipeitCustomField -id 1 33 | Get custom field with ID 1 34 | ``` 35 | 36 | ## PARAMETERS 37 | 38 | ### -apiKey 39 | Deprecated parameter, please use Connect-SnipeitPS instead. 40 | Users API Key for Snipeit. 41 | 42 | ```yaml 43 | Type: String 44 | Parameter Sets: (All) 45 | Aliases: 46 | 47 | Required: False 48 | Position: 3 49 | Default value: None 50 | Accept pipeline input: False 51 | Accept wildcard characters: False 52 | ``` 53 | 54 | ### -id 55 | A id of specific field 56 | 57 | ```yaml 58 | Type: Int32 59 | Parameter Sets: (All) 60 | Aliases: 61 | 62 | Required: False 63 | Position: 1 64 | Default value: 0 65 | Accept pipeline input: False 66 | Accept wildcard characters: False 67 | ``` 68 | 69 | ### -url 70 | Deprecated parameter, please use Connect-SnipeitPS instead. 71 | URL of Snipeit system. 72 | 73 | ```yaml 74 | Type: String 75 | Parameter Sets: (All) 76 | Aliases: 77 | 78 | Required: False 79 | Position: 2 80 | Default value: None 81 | Accept pipeline input: False 82 | Accept wildcard characters: False 83 | ``` 84 | 85 | ### CommonParameters 86 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 87 | 88 | ## INPUTS 89 | 90 | ## OUTPUTS 91 | 92 | ## NOTES 93 | 94 | ## RELATED LINKS 95 | -------------------------------------------------------------------------------- /docs/Get-SnipeitFieldset.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: SnipeitPS-help.xml 3 | Module Name: SnipeitPS 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-SnipeitFieldset 9 | 10 | ## SYNOPSIS 11 | Returns a fieldset or list of Snipe-it Fieldsets 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Get-SnipeitFieldset [[-id] ] [[-url] ] [[-apiKey] ] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | {{ Fill in the Description }} 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | Get-SnipeitFieldset 27 | Get all fieldsets 28 | ``` 29 | 30 | ### EXAMPLE 2 31 | ``` 32 | Get-SnipeitFieldset | Where-Object {$_.name -eq "Windows" } 33 | Gets fieldset by name 34 | ``` 35 | 36 | ## PARAMETERS 37 | 38 | ### -apiKey 39 | Deprecated parameter, please use Connect-SnipeitPS instead. 40 | Users API Key for Snipeit. 41 | 42 | ```yaml 43 | Type: String 44 | Parameter Sets: (All) 45 | Aliases: 46 | 47 | Required: False 48 | Position: 3 49 | Default value: None 50 | Accept pipeline input: False 51 | Accept wildcard characters: False 52 | ``` 53 | 54 | ### -id 55 | A id of specific fieldset 56 | 57 | ```yaml 58 | Type: Int32 59 | Parameter Sets: (All) 60 | Aliases: 61 | 62 | Required: False 63 | Position: 1 64 | Default value: 0 65 | Accept pipeline input: False 66 | Accept wildcard characters: False 67 | ``` 68 | 69 | ### -url 70 | Deprecated parameter, please use Connect-SnipeitPS instead. 71 | URL of Snipeit system. 72 | 73 | ```yaml 74 | Type: String 75 | Parameter Sets: (All) 76 | Aliases: 77 | 78 | Required: False 79 | Position: 2 80 | Default value: None 81 | Accept pipeline input: False 82 | Accept wildcard characters: False 83 | ``` 84 | 85 | ### CommonParameters 86 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 87 | 88 | ## INPUTS 89 | 90 | ## OUTPUTS 91 | 92 | ## NOTES 93 | 94 | ## RELATED LINKS 95 | -------------------------------------------------------------------------------- /docs/Get-SnipeitLicenseSeat.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: SnipeitPS-help.xml 3 | Module Name: SnipeitPS 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-SnipeitLicenseSeat 9 | 10 | ## SYNOPSIS 11 | Gets a list of Snipe-it Licenses Seats or specific Seat 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Get-SnipeitLicenseSeat [-id] [[-seat_id] ] [[-limit] ] [[-offset] ] [-all] 17 | [[-url] ] [[-apiKey] ] [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | {{ Fill in the Description }} 22 | 23 | ## EXAMPLES 24 | 25 | ### EXAMPLE 1 26 | ``` 27 | Get-SnipeitLicenseSeat -id 1 28 | ``` 29 | 30 | ## PARAMETERS 31 | 32 | ### -all 33 | A return all results, works with -offset and other parameters 34 | 35 | ```yaml 36 | Type: SwitchParameter 37 | Parameter Sets: (All) 38 | Aliases: 39 | 40 | Required: False 41 | Position: Named 42 | Default value: False 43 | Accept pipeline input: False 44 | Accept wildcard characters: False 45 | ``` 46 | 47 | ### -apiKey 48 | Deprecated parameter, please use Connect-SnipeitPS instead. 49 | Users API Key for Snipeit. 50 | 51 | ```yaml 52 | Type: String 53 | Parameter Sets: (All) 54 | Aliases: 55 | 56 | Required: False 57 | Position: 6 58 | Default value: None 59 | Accept pipeline input: False 60 | Accept wildcard characters: False 61 | ``` 62 | 63 | ### -id 64 | A id of specific License 65 | 66 | ```yaml 67 | Type: Int32 68 | Parameter Sets: (All) 69 | Aliases: 70 | 71 | Required: True 72 | Position: 1 73 | Default value: 0 74 | Accept pipeline input: False 75 | Accept wildcard characters: False 76 | ``` 77 | 78 | ### -limit 79 | Specify the number of results you wish to return. 80 | Defaults to 50. 81 | Defines batch size for -all 82 | 83 | ```yaml 84 | Type: Int32 85 | Parameter Sets: (All) 86 | Aliases: 87 | 88 | Required: False 89 | Position: 3 90 | Default value: 50 91 | Accept pipeline input: False 92 | Accept wildcard characters: False 93 | ``` 94 | 95 | ### -offset 96 | Offset to use 97 | 98 | ```yaml 99 | Type: Int32 100 | Parameter Sets: (All) 101 | Aliases: 102 | 103 | Required: False 104 | Position: 4 105 | Default value: 0 106 | Accept pipeline input: False 107 | Accept wildcard characters: False 108 | ``` 109 | 110 | ### -seat_id 111 | A id of specific seat 112 | 113 | ```yaml 114 | Type: Int32 115 | Parameter Sets: (All) 116 | Aliases: 117 | 118 | Required: False 119 | Position: 2 120 | Default value: 0 121 | Accept pipeline input: False 122 | Accept wildcard characters: False 123 | ``` 124 | 125 | ### -url 126 | Deprecated parameter, please use Connect-SnipeitPS instead. 127 | URL of Snipeit system. 128 | 129 | ```yaml 130 | Type: String 131 | Parameter Sets: (All) 132 | Aliases: 133 | 134 | Required: False 135 | Position: 5 136 | Default value: None 137 | Accept pipeline input: False 138 | Accept wildcard characters: False 139 | ``` 140 | 141 | ### CommonParameters 142 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 143 | 144 | ## INPUTS 145 | 146 | ## OUTPUTS 147 | 148 | ## NOTES 149 | 150 | ## RELATED LINKS 151 | -------------------------------------------------------------------------------- /docs/New-SnipeitAudit.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: SnipeitPS-help.xml 3 | Module Name: SnipeitPS 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # New-SnipeitAudit 9 | 10 | ## SYNOPSIS 11 | Add a new Audit to Snipe-it asset system 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | New-SnipeitAudit [-tag] [[-location_id] ] [[-next_audit_date] ] [[-url] ] 17 | [[-apiKey] ] [-WhatIf] [-Confirm] [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | Long description 22 | 23 | ## EXAMPLES 24 | 25 | ### EXAMPLE 1 26 | ``` 27 | New-SnipeitAudit -tag 1 -location_id 1 28 | ``` 29 | 30 | ## PARAMETERS 31 | 32 | ### -apiKey 33 | {{ Fill apiKey Description }} 34 | 35 | ```yaml 36 | Type: String 37 | Parameter Sets: (All) 38 | Aliases: 39 | 40 | Required: False 41 | Position: 5 42 | Default value: None 43 | Accept pipeline input: False 44 | Accept wildcard characters: False 45 | ``` 46 | 47 | ### -location_id 48 | ID of the location you want to associate with the audit 49 | 50 | ```yaml 51 | Type: Int32 52 | Parameter Sets: (All) 53 | Aliases: 54 | 55 | Required: False 56 | Position: 2 57 | Default value: 0 58 | Accept pipeline input: False 59 | Accept wildcard characters: False 60 | ``` 61 | 62 | ### -next_audit_date 63 | Due date for the asset's next audit 64 | 65 | ```yaml 66 | Type: DateTime 67 | Parameter Sets: (All) 68 | Aliases: 69 | 70 | Required: False 71 | Position: 3 72 | Default value: None 73 | Accept pipeline input: False 74 | Accept wildcard characters: False 75 | ``` 76 | 77 | ### -tag 78 | The asset tag of the asset you wish to audit 79 | 80 | ```yaml 81 | Type: String 82 | Parameter Sets: (All) 83 | Aliases: 84 | 85 | Required: True 86 | Position: 1 87 | Default value: None 88 | Accept pipeline input: False 89 | Accept wildcard characters: False 90 | ``` 91 | 92 | ### -url 93 | {{ Fill url Description }} 94 | 95 | ```yaml 96 | Type: String 97 | Parameter Sets: (All) 98 | Aliases: 99 | 100 | Required: False 101 | Position: 4 102 | Default value: None 103 | Accept pipeline input: False 104 | Accept wildcard characters: False 105 | ``` 106 | 107 | ### -Confirm 108 | Prompts you for confirmation before running the cmdlet. 109 | 110 | ```yaml 111 | Type: SwitchParameter 112 | Parameter Sets: (All) 113 | Aliases: cf 114 | 115 | Required: False 116 | Position: Named 117 | Default value: None 118 | Accept pipeline input: False 119 | Accept wildcard characters: False 120 | ``` 121 | 122 | ### -WhatIf 123 | Shows what would happen if the cmdlet runs. 124 | The cmdlet is not run. 125 | 126 | ```yaml 127 | Type: SwitchParameter 128 | Parameter Sets: (All) 129 | Aliases: wi 130 | 131 | Required: False 132 | Position: Named 133 | Default value: None 134 | Accept pipeline input: False 135 | Accept wildcard characters: False 136 | ``` 137 | 138 | ### CommonParameters 139 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 140 | 141 | ## INPUTS 142 | 143 | ## OUTPUTS 144 | 145 | ## NOTES 146 | 147 | ## RELATED LINKS 148 | -------------------------------------------------------------------------------- /docs/New-SnipeitCompany.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: SnipeitPS-help.xml 3 | Module Name: SnipeitPS 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # New-SnipeitCompany 9 | 10 | ## SYNOPSIS 11 | Creates a new Company 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | New-SnipeitCompany [-name] [[-image] ] [[-url] ] [[-apiKey] ] [-WhatIf] 17 | [-Confirm] [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | Creates new company on Snipe-It system 22 | 23 | ## EXAMPLES 24 | 25 | ### EXAMPLE 1 26 | ``` 27 | New-SnipeitCompany -name "Acme Company" 28 | ``` 29 | 30 | ## PARAMETERS 31 | 32 | ### -apiKey 33 | Deprecated parameter, please use Connect-SnipeitPS instead. 34 | Users API Key API Key for Snipeit. 35 | 36 | ```yaml 37 | Type: String 38 | Parameter Sets: (All) 39 | Aliases: 40 | 41 | Required: False 42 | Position: 4 43 | Default value: None 44 | Accept pipeline input: False 45 | Accept wildcard characters: False 46 | ``` 47 | 48 | ### -image 49 | Company image filename and path 50 | 51 | ```yaml 52 | Type: String 53 | Parameter Sets: (All) 54 | Aliases: 55 | 56 | Required: False 57 | Position: 2 58 | Default value: None 59 | Accept pipeline input: False 60 | Accept wildcard characters: False 61 | ``` 62 | 63 | ### -name 64 | Comapany name 65 | 66 | ```yaml 67 | Type: String 68 | Parameter Sets: (All) 69 | Aliases: 70 | 71 | Required: True 72 | Position: 1 73 | Default value: None 74 | Accept pipeline input: False 75 | Accept wildcard characters: False 76 | ``` 77 | 78 | ### -url 79 | Deprecated parameter, please use Connect-SnipeitPS instead. 80 | URL of Snipeit system. 81 | 82 | ```yaml 83 | Type: String 84 | Parameter Sets: (All) 85 | Aliases: 86 | 87 | Required: False 88 | Position: 3 89 | Default value: None 90 | Accept pipeline input: False 91 | Accept wildcard characters: False 92 | ``` 93 | 94 | ### -Confirm 95 | Prompts you for confirmation before running the cmdlet. 96 | 97 | ```yaml 98 | Type: SwitchParameter 99 | Parameter Sets: (All) 100 | Aliases: cf 101 | 102 | Required: False 103 | Position: Named 104 | Default value: None 105 | Accept pipeline input: False 106 | Accept wildcard characters: False 107 | ``` 108 | 109 | ### -WhatIf 110 | Shows what would happen if the cmdlet runs. 111 | The cmdlet is not run. 112 | 113 | ```yaml 114 | Type: SwitchParameter 115 | Parameter Sets: (All) 116 | Aliases: wi 117 | 118 | Required: False 119 | Position: Named 120 | Default value: None 121 | Accept pipeline input: False 122 | Accept wildcard characters: False 123 | ``` 124 | 125 | ### CommonParameters 126 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 127 | 128 | ## INPUTS 129 | 130 | ## OUTPUTS 131 | 132 | ## NOTES 133 | 134 | ## RELATED LINKS 135 | -------------------------------------------------------------------------------- /docs/New-SnipeitManufacturer.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: SnipeitPS-help.xml 3 | Module Name: SnipeitPS 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # New-SnipeitManufacturer 9 | 10 | ## SYNOPSIS 11 | Add a new Manufacturer to Snipe-it asset system 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | New-SnipeitManufacturer [-Name] [[-image] ] [-image_delete] [[-url] ] 17 | [[-apiKey] ] [-WhatIf] [-Confirm] [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | Long description 22 | 23 | ## EXAMPLES 24 | 25 | ### EXAMPLE 1 26 | ``` 27 | New-SnipeitManufacturer -name "HP" 28 | ``` 29 | 30 | ## PARAMETERS 31 | 32 | ### -apiKey 33 | Deprecated parameter, please use Connect-SnipeitPS instead. 34 | Users API Key for Snipeit. 35 | 36 | ```yaml 37 | Type: String 38 | Parameter Sets: (All) 39 | Aliases: 40 | 41 | Required: False 42 | Position: 4 43 | Default value: None 44 | Accept pipeline input: False 45 | Accept wildcard characters: False 46 | ``` 47 | 48 | ### -image 49 | Manufacturer Image filename and path 50 | 51 | ```yaml 52 | Type: String 53 | Parameter Sets: (All) 54 | Aliases: 55 | 56 | Required: False 57 | Position: 2 58 | Default value: None 59 | Accept pipeline input: False 60 | Accept wildcard characters: False 61 | ``` 62 | 63 | ### -image_delete 64 | Remove current image 65 | 66 | ```yaml 67 | Type: SwitchParameter 68 | Parameter Sets: (All) 69 | Aliases: 70 | 71 | Required: False 72 | Position: Named 73 | Default value: False 74 | Accept pipeline input: False 75 | Accept wildcard characters: False 76 | ``` 77 | 78 | ### -Name 79 | Name of the Manufacturer 80 | 81 | ```yaml 82 | Type: String 83 | Parameter Sets: (All) 84 | Aliases: 85 | 86 | Required: True 87 | Position: 1 88 | Default value: None 89 | Accept pipeline input: False 90 | Accept wildcard characters: False 91 | ``` 92 | 93 | ### -url 94 | Deprecated parameter, please use Connect-SnipeitPS instead. 95 | URL of Snipeit system. 96 | 97 | ```yaml 98 | Type: String 99 | Parameter Sets: (All) 100 | Aliases: 101 | 102 | Required: False 103 | Position: 3 104 | Default value: None 105 | Accept pipeline input: False 106 | Accept wildcard characters: False 107 | ``` 108 | 109 | ### -Confirm 110 | Prompts you for confirmation before running the cmdlet. 111 | 112 | ```yaml 113 | Type: SwitchParameter 114 | Parameter Sets: (All) 115 | Aliases: cf 116 | 117 | Required: False 118 | Position: Named 119 | Default value: None 120 | Accept pipeline input: False 121 | Accept wildcard characters: False 122 | ``` 123 | 124 | ### -WhatIf 125 | Shows what would happen if the cmdlet runs. 126 | The cmdlet is not run. 127 | 128 | ```yaml 129 | Type: SwitchParameter 130 | Parameter Sets: (All) 131 | Aliases: wi 132 | 133 | Required: False 134 | Position: Named 135 | Default value: None 136 | Accept pipeline input: False 137 | Accept wildcard characters: False 138 | ``` 139 | 140 | ### CommonParameters 141 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 142 | 143 | ## INPUTS 144 | 145 | ## OUTPUTS 146 | 147 | ## NOTES 148 | 149 | ## RELATED LINKS 150 | -------------------------------------------------------------------------------- /docs/Remove-SnipeitAccessory.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: SnipeitPS-help.xml 3 | Module Name: SnipeitPS 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Remove-SnipeitAccessory 9 | 10 | ## SYNOPSIS 11 | Removes Accessory from Snipe-it asset system 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Remove-SnipeitAccessory [-id] [[-url] ] [[-apiKey] ] [-WhatIf] [-Confirm] 17 | [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | Removes Accessory or multiple Accessoriers from Snipe-it asset system 22 | 23 | ## EXAMPLES 24 | 25 | ### EXAMPLE 1 26 | ``` 27 | Remove-SnipeitAccessory -ID 44 -Verbose 28 | ``` 29 | 30 | ### EXAMPLE 2 31 | ``` 32 | Get-SnipeitAccessory -search needle | Remove-SnipeitAccessory 33 | ``` 34 | 35 | ## PARAMETERS 36 | 37 | ### -apiKey 38 | Deprecated parameter, please use Connect-SnipeitPS instead. 39 | User's API Key for Snipeit. 40 | 41 | ```yaml 42 | Type: String 43 | Parameter Sets: (All) 44 | Aliases: 45 | 46 | Required: False 47 | Position: 3 48 | Default value: None 49 | Accept pipeline input: False 50 | Accept wildcard characters: False 51 | ``` 52 | 53 | ### -id 54 | Unique ID For accessory to be removed 55 | 56 | ```yaml 57 | Type: Int32[] 58 | Parameter Sets: (All) 59 | Aliases: 60 | 61 | Required: True 62 | Position: 1 63 | Default value: None 64 | Accept pipeline input: True (ByPropertyName) 65 | Accept wildcard characters: False 66 | ``` 67 | 68 | ### -url 69 | Deprecated parameter, please use Connect-SnipeitPS instead. 70 | URL of Snipeit system. 71 | 72 | ```yaml 73 | Type: String 74 | Parameter Sets: (All) 75 | Aliases: 76 | 77 | Required: False 78 | Position: 2 79 | Default value: None 80 | Accept pipeline input: False 81 | Accept wildcard characters: False 82 | ``` 83 | 84 | ### -Confirm 85 | Prompts you for confirmation before running the cmdlet. 86 | 87 | ```yaml 88 | Type: SwitchParameter 89 | Parameter Sets: (All) 90 | Aliases: cf 91 | 92 | Required: False 93 | Position: Named 94 | Default value: None 95 | Accept pipeline input: False 96 | Accept wildcard characters: False 97 | ``` 98 | 99 | ### -WhatIf 100 | Shows what would happen if the cmdlet runs. 101 | The cmdlet is not run. 102 | 103 | ```yaml 104 | Type: SwitchParameter 105 | Parameter Sets: (All) 106 | Aliases: wi 107 | 108 | Required: False 109 | Position: Named 110 | Default value: None 111 | Accept pipeline input: False 112 | Accept wildcard characters: False 113 | ``` 114 | 115 | ### CommonParameters 116 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 117 | 118 | ## INPUTS 119 | 120 | ## OUTPUTS 121 | 122 | ## NOTES 123 | 124 | ## RELATED LINKS 125 | -------------------------------------------------------------------------------- /docs/Remove-SnipeitAsset.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: SnipeitPS-help.xml 3 | Module Name: SnipeitPS 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Remove-SnipeitAsset 9 | 10 | ## SYNOPSIS 11 | Removes Asset from Snipe-it asset system 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Remove-SnipeitAsset [-id] [[-url] ] [[-apiKey] ] [-WhatIf] [-Confirm] 17 | [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | Removes asset or multiple assets from Snipe-it asset system 22 | 23 | ## EXAMPLES 24 | 25 | ### EXAMPLE 1 26 | ``` 27 | Remove-SnipeitAsset -ID 44 -Verbose 28 | ``` 29 | 30 | ### EXAMPLE 2 31 | ``` 32 | Get-SnipeitAsset -serial 123456789 | Remove-SnipeitAsset 33 | ``` 34 | 35 | ## PARAMETERS 36 | 37 | ### -apiKey 38 | Deprecated parameter, please use Connect-SnipeitPS instead. 39 | User's API Key for Snipeit. 40 | 41 | ```yaml 42 | Type: String 43 | Parameter Sets: (All) 44 | Aliases: 45 | 46 | Required: False 47 | Position: 3 48 | Default value: None 49 | Accept pipeline input: False 50 | Accept wildcard characters: False 51 | ``` 52 | 53 | ### -id 54 | Unique ID For Asset to be removed 55 | 56 | ```yaml 57 | Type: Int32[] 58 | Parameter Sets: (All) 59 | Aliases: 60 | 61 | Required: True 62 | Position: 1 63 | Default value: None 64 | Accept pipeline input: True (ByPropertyName) 65 | Accept wildcard characters: False 66 | ``` 67 | 68 | ### -url 69 | Deprecated parameter, please use Connect-SnipeitPS instead. 70 | URL of Snipeit system. 71 | 72 | ```yaml 73 | Type: String 74 | Parameter Sets: (All) 75 | Aliases: 76 | 77 | Required: False 78 | Position: 2 79 | Default value: None 80 | Accept pipeline input: False 81 | Accept wildcard characters: False 82 | ``` 83 | 84 | ### -Confirm 85 | Prompts you for confirmation before running the cmdlet. 86 | 87 | ```yaml 88 | Type: SwitchParameter 89 | Parameter Sets: (All) 90 | Aliases: cf 91 | 92 | Required: False 93 | Position: Named 94 | Default value: None 95 | Accept pipeline input: False 96 | Accept wildcard characters: False 97 | ``` 98 | 99 | ### -WhatIf 100 | Shows what would happen if the cmdlet runs. 101 | The cmdlet is not run. 102 | 103 | ```yaml 104 | Type: SwitchParameter 105 | Parameter Sets: (All) 106 | Aliases: wi 107 | 108 | Required: False 109 | Position: Named 110 | Default value: None 111 | Accept pipeline input: False 112 | Accept wildcard characters: False 113 | ``` 114 | 115 | ### CommonParameters 116 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 117 | 118 | ## INPUTS 119 | 120 | ## OUTPUTS 121 | 122 | ## NOTES 123 | 124 | ## RELATED LINKS 125 | -------------------------------------------------------------------------------- /docs/Remove-SnipeitAssetMaintenance.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: SnipeitPS-help.xml 3 | Module Name: SnipeitPS 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Remove-SnipeitAssetMaintenance 9 | 10 | ## SYNOPSIS 11 | Remove asset maintenance from Snipe-it asset system 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Remove-SnipeitAssetMaintenance [-id] [[-url] ] [[-apiKey] ] [-WhatIf] [-Confirm] 17 | [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | Removes asset maintenance event or events from Snipe-it asset system by ID 22 | 23 | ## EXAMPLES 24 | 25 | ### EXAMPLE 1 26 | ``` 27 | Remove-SnipeitAssetMaintenance -ID 44 28 | ``` 29 | 30 | ## PARAMETERS 31 | 32 | ### -apiKey 33 | {{ Fill apiKey Description }} 34 | 35 | ```yaml 36 | Type: String 37 | Parameter Sets: (All) 38 | Aliases: 39 | 40 | Required: False 41 | Position: 3 42 | Default value: None 43 | Accept pipeline input: False 44 | Accept wildcard characters: False 45 | ``` 46 | 47 | ### -id 48 | Unique ID of the asset maintenance to be removed 49 | 50 | ```yaml 51 | Type: Int32[] 52 | Parameter Sets: (All) 53 | Aliases: 54 | 55 | Required: True 56 | Position: 1 57 | Default value: None 58 | Accept pipeline input: True (ByPropertyName) 59 | Accept wildcard characters: False 60 | ``` 61 | 62 | ### -url 63 | Deprecated parameter, please use Connect-SnipeitPS instead. 64 | URL of Snipeit system. 65 | 66 | ```yaml 67 | Type: String 68 | Parameter Sets: (All) 69 | Aliases: 70 | 71 | Required: False 72 | Position: 2 73 | Default value: None 74 | Accept pipeline input: False 75 | Accept wildcard characters: False 76 | ``` 77 | 78 | ### -Confirm 79 | Prompts you for confirmation before running the cmdlet. 80 | 81 | ```yaml 82 | Type: SwitchParameter 83 | Parameter Sets: (All) 84 | Aliases: cf 85 | 86 | Required: False 87 | Position: Named 88 | Default value: None 89 | Accept pipeline input: False 90 | Accept wildcard characters: False 91 | ``` 92 | 93 | ### -WhatIf 94 | Shows what would happen if the cmdlet runs. 95 | The cmdlet is not run. 96 | 97 | ```yaml 98 | Type: SwitchParameter 99 | Parameter Sets: (All) 100 | Aliases: wi 101 | 102 | Required: False 103 | Position: Named 104 | Default value: None 105 | Accept pipeline input: False 106 | Accept wildcard characters: False 107 | ``` 108 | 109 | ### CommonParameters 110 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 111 | 112 | ## INPUTS 113 | 114 | ## OUTPUTS 115 | 116 | ## NOTES 117 | 118 | ## RELATED LINKS 119 | -------------------------------------------------------------------------------- /docs/Remove-SnipeitCategory.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: SnipeitPS-help.xml 3 | Module Name: SnipeitPS 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Remove-SnipeitCategory 9 | 10 | ## SYNOPSIS 11 | Removes category from Snipe-it asset system 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Remove-SnipeitCategory [-id] [[-url] ] [[-apiKey] ] [-WhatIf] [-Confirm] 17 | [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | Removes category or multiple categories from Snipe-it asset system 22 | 23 | ## EXAMPLES 24 | 25 | ### EXAMPLE 1 26 | ``` 27 | Remove-SnipeitCategory -ID 44 28 | ``` 29 | 30 | ### EXAMPLE 2 31 | ``` 32 | Get-SnipeitCategory -search something | Remove-SnipeitCategory 33 | ``` 34 | 35 | ## PARAMETERS 36 | 37 | ### -apiKey 38 | Deprecated parameter, please use Connect-SnipeitPS instead. 39 | User's API Key for Snipeit. 40 | 41 | ```yaml 42 | Type: String 43 | Parameter Sets: (All) 44 | Aliases: 45 | 46 | Required: False 47 | Position: 3 48 | Default value: None 49 | Accept pipeline input: False 50 | Accept wildcard characters: False 51 | ``` 52 | 53 | ### -id 54 | Unique ID For categoryto be removed 55 | 56 | ```yaml 57 | Type: Int32[] 58 | Parameter Sets: (All) 59 | Aliases: 60 | 61 | Required: True 62 | Position: 1 63 | Default value: None 64 | Accept pipeline input: True (ByPropertyName) 65 | Accept wildcard characters: False 66 | ``` 67 | 68 | ### -url 69 | Deprecated parameter, please use Connect-SnipeitPS instead. 70 | URL of Snipeit system. 71 | 72 | ```yaml 73 | Type: String 74 | Parameter Sets: (All) 75 | Aliases: 76 | 77 | Required: False 78 | Position: 2 79 | Default value: None 80 | Accept pipeline input: False 81 | Accept wildcard characters: False 82 | ``` 83 | 84 | ### -Confirm 85 | Prompts you for confirmation before running the cmdlet. 86 | 87 | ```yaml 88 | Type: SwitchParameter 89 | Parameter Sets: (All) 90 | Aliases: cf 91 | 92 | Required: False 93 | Position: Named 94 | Default value: None 95 | Accept pipeline input: False 96 | Accept wildcard characters: False 97 | ``` 98 | 99 | ### -WhatIf 100 | Shows what would happen if the cmdlet runs. 101 | The cmdlet is not run. 102 | 103 | ```yaml 104 | Type: SwitchParameter 105 | Parameter Sets: (All) 106 | Aliases: wi 107 | 108 | Required: False 109 | Position: Named 110 | Default value: None 111 | Accept pipeline input: False 112 | Accept wildcard characters: False 113 | ``` 114 | 115 | ### CommonParameters 116 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 117 | 118 | ## INPUTS 119 | 120 | ## OUTPUTS 121 | 122 | ## NOTES 123 | 124 | ## RELATED LINKS 125 | -------------------------------------------------------------------------------- /docs/Remove-SnipeitCompany.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: SnipeitPS-help.xml 3 | Module Name: SnipeitPS 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Remove-SnipeitCompany 9 | 10 | ## SYNOPSIS 11 | Removes Company from Snipe-it asset system 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Remove-SnipeitCompany [-id] [[-url] ] [[-apiKey] ] [-WhatIf] [-Confirm] 17 | [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | Removes Company or multiple Companies from Snipe-it asset system 22 | 23 | ## EXAMPLES 24 | 25 | ### EXAMPLE 1 26 | ``` 27 | Remove-SnipeitCompany -ID 44 28 | ``` 29 | 30 | ### EXAMPLE 2 31 | ``` 32 | Get-SnipeitCompany | | Where-object {$_.name -like '*some*'} | Remove-SnipeitCompany 33 | ``` 34 | 35 | ## PARAMETERS 36 | 37 | ### -apiKey 38 | Deprecated parameter, please use Connect-SnipeitPS instead. 39 | User's API Key for Snipeit. 40 | 41 | ```yaml 42 | Type: String 43 | Parameter Sets: (All) 44 | Aliases: 45 | 46 | Required: False 47 | Position: 3 48 | Default value: None 49 | Accept pipeline input: False 50 | Accept wildcard characters: False 51 | ``` 52 | 53 | ### -id 54 | Unique ID For Company to be removed 55 | 56 | ```yaml 57 | Type: Int32[] 58 | Parameter Sets: (All) 59 | Aliases: 60 | 61 | Required: True 62 | Position: 1 63 | Default value: None 64 | Accept pipeline input: True (ByPropertyName) 65 | Accept wildcard characters: False 66 | ``` 67 | 68 | ### -url 69 | Deprecated parameter, please use Connect-SnipeitPS instead. 70 | URL of Snipeit system. 71 | 72 | ```yaml 73 | Type: String 74 | Parameter Sets: (All) 75 | Aliases: 76 | 77 | Required: False 78 | Position: 2 79 | Default value: None 80 | Accept pipeline input: False 81 | Accept wildcard characters: False 82 | ``` 83 | 84 | ### -Confirm 85 | Prompts you for confirmation before running the cmdlet. 86 | 87 | ```yaml 88 | Type: SwitchParameter 89 | Parameter Sets: (All) 90 | Aliases: cf 91 | 92 | Required: False 93 | Position: Named 94 | Default value: None 95 | Accept pipeline input: False 96 | Accept wildcard characters: False 97 | ``` 98 | 99 | ### -WhatIf 100 | Shows what would happen if the cmdlet runs. 101 | The cmdlet is not run. 102 | 103 | ```yaml 104 | Type: SwitchParameter 105 | Parameter Sets: (All) 106 | Aliases: wi 107 | 108 | Required: False 109 | Position: Named 110 | Default value: None 111 | Accept pipeline input: False 112 | Accept wildcard characters: False 113 | ``` 114 | 115 | ### CommonParameters 116 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 117 | 118 | ## INPUTS 119 | 120 | ## OUTPUTS 121 | 122 | ## NOTES 123 | 124 | ## RELATED LINKS 125 | -------------------------------------------------------------------------------- /docs/Remove-SnipeitComponent.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: SnipeitPS-help.xml 3 | Module Name: SnipeitPS 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Remove-SnipeitComponent 9 | 10 | ## SYNOPSIS 11 | Removes component from Snipe-it asset system 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Remove-SnipeitComponent [-id] [[-url] ] [[-apiKey] ] [-WhatIf] [-Confirm] 17 | [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | Removes component or multiple components from Snipe-it asset system 22 | 23 | ## EXAMPLES 24 | 25 | ### EXAMPLE 1 26 | ``` 27 | Remove-SnipeitComponent -ID 44 28 | ``` 29 | 30 | ### EXAMPLE 2 31 | ``` 32 | Get-SnipeitComponent -search 123456789 | Remove-SnipeitComponent 33 | ``` 34 | 35 | ## PARAMETERS 36 | 37 | ### -apiKey 38 | Deprecated parameter, please use Connect-SnipeitPS instead. 39 | User's API Key for Snipeit. 40 | 41 | ```yaml 42 | Type: String 43 | Parameter Sets: (All) 44 | Aliases: 45 | 46 | Required: False 47 | Position: 3 48 | Default value: None 49 | Accept pipeline input: False 50 | Accept wildcard characters: False 51 | ``` 52 | 53 | ### -id 54 | {{ Fill id Description }} 55 | 56 | ```yaml 57 | Type: Int32[] 58 | Parameter Sets: (All) 59 | Aliases: 60 | 61 | Required: True 62 | Position: 1 63 | Default value: None 64 | Accept pipeline input: True (ByPropertyName) 65 | Accept wildcard characters: False 66 | ``` 67 | 68 | ### -url 69 | Deprecated parameter, please use Connect-SnipeitPS instead. 70 | URL of Snipeit system. 71 | 72 | ```yaml 73 | Type: String 74 | Parameter Sets: (All) 75 | Aliases: 76 | 77 | Required: False 78 | Position: 2 79 | Default value: None 80 | Accept pipeline input: False 81 | Accept wildcard characters: False 82 | ``` 83 | 84 | ### -Confirm 85 | Prompts you for confirmation before running the cmdlet. 86 | 87 | ```yaml 88 | Type: SwitchParameter 89 | Parameter Sets: (All) 90 | Aliases: cf 91 | 92 | Required: False 93 | Position: Named 94 | Default value: None 95 | Accept pipeline input: False 96 | Accept wildcard characters: False 97 | ``` 98 | 99 | ### -WhatIf 100 | Shows what would happen if the cmdlet runs. 101 | The cmdlet is not run. 102 | 103 | ```yaml 104 | Type: SwitchParameter 105 | Parameter Sets: (All) 106 | Aliases: wi 107 | 108 | Required: False 109 | Position: Named 110 | Default value: None 111 | Accept pipeline input: False 112 | Accept wildcard characters: False 113 | ``` 114 | 115 | ### CommonParameters 116 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 117 | 118 | ## INPUTS 119 | 120 | ## OUTPUTS 121 | 122 | ## NOTES 123 | 124 | ## RELATED LINKS 125 | -------------------------------------------------------------------------------- /docs/Remove-SnipeitConsumable.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: SnipeitPS-help.xml 3 | Module Name: SnipeitPS 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Remove-SnipeitConsumable 9 | 10 | ## SYNOPSIS 11 | Removes consumable from Snipe-it asset system 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Remove-SnipeitConsumable [-id] [[-url] ] [[-apiKey] ] [-WhatIf] [-Confirm] 17 | [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | Removes consumable or multiple consumables from Snipe-it asset system 22 | 23 | ## EXAMPLES 24 | 25 | ### EXAMPLE 1 26 | ``` 27 | Remove-SnipeitConsumable -ID 44 28 | ``` 29 | 30 | ### EXAMPLE 2 31 | ``` 32 | Get-SnipeitConsumable -search "paper" | Remove-SnipeitConsumable 33 | ``` 34 | 35 | ## PARAMETERS 36 | 37 | ### -apiKey 38 | Deprecated parameter, please use Connect-SnipeitPS instead. 39 | User's API Key for Snipeit. 40 | 41 | ```yaml 42 | Type: String 43 | Parameter Sets: (All) 44 | Aliases: 45 | 46 | Required: False 47 | Position: 3 48 | Default value: None 49 | Accept pipeline input: False 50 | Accept wildcard characters: False 51 | ``` 52 | 53 | ### -id 54 | Unique ID For consumable to be removed 55 | 56 | ```yaml 57 | Type: Int32[] 58 | Parameter Sets: (All) 59 | Aliases: 60 | 61 | Required: True 62 | Position: 1 63 | Default value: None 64 | Accept pipeline input: True (ByPropertyName) 65 | Accept wildcard characters: False 66 | ``` 67 | 68 | ### -url 69 | Deprecated parameter, please use Connect-SnipeitPS instead. 70 | URL of Snipeit system. 71 | 72 | ```yaml 73 | Type: String 74 | Parameter Sets: (All) 75 | Aliases: 76 | 77 | Required: False 78 | Position: 2 79 | Default value: None 80 | Accept pipeline input: False 81 | Accept wildcard characters: False 82 | ``` 83 | 84 | ### -Confirm 85 | Prompts you for confirmation before running the cmdlet. 86 | 87 | ```yaml 88 | Type: SwitchParameter 89 | Parameter Sets: (All) 90 | Aliases: cf 91 | 92 | Required: False 93 | Position: Named 94 | Default value: None 95 | Accept pipeline input: False 96 | Accept wildcard characters: False 97 | ``` 98 | 99 | ### -WhatIf 100 | Shows what would happen if the cmdlet runs. 101 | The cmdlet is not run. 102 | 103 | ```yaml 104 | Type: SwitchParameter 105 | Parameter Sets: (All) 106 | Aliases: wi 107 | 108 | Required: False 109 | Position: Named 110 | Default value: None 111 | Accept pipeline input: False 112 | Accept wildcard characters: False 113 | ``` 114 | 115 | ### CommonParameters 116 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 117 | 118 | ## INPUTS 119 | 120 | ## OUTPUTS 121 | 122 | ## NOTES 123 | 124 | ## RELATED LINKS 125 | -------------------------------------------------------------------------------- /docs/Remove-SnipeitCustomField.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: SnipeitPS-help.xml 3 | Module Name: SnipeitPS 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Remove-SnipeitCustomField 9 | 10 | ## SYNOPSIS 11 | Removes custom field from Snipe-it asset system 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Remove-SnipeitCustomField [-id] [[-url] ] [[-apiKey] ] [-WhatIf] [-Confirm] 17 | [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | Removes custom field or multiple fields from Snipe-it asset system 22 | 23 | ## EXAMPLES 24 | 25 | ### EXAMPLE 1 26 | ``` 27 | Remove-SnipeitCustomField -ID 44 -Verbose 28 | ``` 29 | 30 | ### EXAMPLE 2 31 | ``` 32 | Get-SnipeitCustomField | Where-object {$_.name -like '*address*'} | Remove-SnipeitCustomField 33 | ``` 34 | 35 | ## PARAMETERS 36 | 37 | ### -apiKey 38 | Deprecated parameter, please use Connect-SnipeitPS instead. 39 | User's API Key for Snipeit. 40 | 41 | ```yaml 42 | Type: String 43 | Parameter Sets: (All) 44 | Aliases: 45 | 46 | Required: False 47 | Position: 3 48 | Default value: None 49 | Accept pipeline input: False 50 | Accept wildcard characters: False 51 | ``` 52 | 53 | ### -id 54 | Unique ID For field to be removed 55 | 56 | ```yaml 57 | Type: Int32[] 58 | Parameter Sets: (All) 59 | Aliases: 60 | 61 | Required: True 62 | Position: 1 63 | Default value: None 64 | Accept pipeline input: True (ByPropertyName) 65 | Accept wildcard characters: False 66 | ``` 67 | 68 | ### -url 69 | Deprecated parameter, please use Connect-SnipeitPS instead. 70 | URL of Snipeit system. 71 | 72 | ```yaml 73 | Type: String 74 | Parameter Sets: (All) 75 | Aliases: 76 | 77 | Required: False 78 | Position: 2 79 | Default value: None 80 | Accept pipeline input: False 81 | Accept wildcard characters: False 82 | ``` 83 | 84 | ### -Confirm 85 | Prompts you for confirmation before running the cmdlet. 86 | 87 | ```yaml 88 | Type: SwitchParameter 89 | Parameter Sets: (All) 90 | Aliases: cf 91 | 92 | Required: False 93 | Position: Named 94 | Default value: None 95 | Accept pipeline input: False 96 | Accept wildcard characters: False 97 | ``` 98 | 99 | ### -WhatIf 100 | Shows what would happen if the cmdlet runs. 101 | The cmdlet is not run. 102 | 103 | ```yaml 104 | Type: SwitchParameter 105 | Parameter Sets: (All) 106 | Aliases: wi 107 | 108 | Required: False 109 | Position: Named 110 | Default value: None 111 | Accept pipeline input: False 112 | Accept wildcard characters: False 113 | ``` 114 | 115 | ### CommonParameters 116 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 117 | 118 | ## INPUTS 119 | 120 | ## OUTPUTS 121 | 122 | ## NOTES 123 | 124 | ## RELATED LINKS 125 | -------------------------------------------------------------------------------- /docs/Remove-SnipeitDepartment.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: SnipeitPS-help.xml 3 | Module Name: SnipeitPS 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Remove-SnipeitDepartment 9 | 10 | ## SYNOPSIS 11 | Removes department from Snipe-it asset system 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Remove-SnipeitDepartment [-id] [[-url] ] [[-apiKey] ] [-WhatIf] [-Confirm] 17 | [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | Removes department or multiple departments from Snipe-it asset system 22 | 23 | ## EXAMPLES 24 | 25 | ### EXAMPLE 1 26 | ``` 27 | Remove-SnipeitDepartment -ID 44 28 | ``` 29 | 30 | ### EXAMPLE 2 31 | ``` 32 | Get-SnipeitDepartment | Where-object {$_.name -like '*head*'} | Remove-SnipeitDepartment 33 | ``` 34 | 35 | ## PARAMETERS 36 | 37 | ### -apiKey 38 | Deprecated parameter, please use Connect-SnipeitPS instead. 39 | User's API Key for Snipeit. 40 | 41 | ```yaml 42 | Type: String 43 | Parameter Sets: (All) 44 | Aliases: 45 | 46 | Required: False 47 | Position: 3 48 | Default value: None 49 | Accept pipeline input: False 50 | Accept wildcard characters: False 51 | ``` 52 | 53 | ### -id 54 | Unique ID For department to be removed 55 | 56 | ```yaml 57 | Type: Int32[] 58 | Parameter Sets: (All) 59 | Aliases: 60 | 61 | Required: True 62 | Position: 1 63 | Default value: None 64 | Accept pipeline input: True (ByPropertyName) 65 | Accept wildcard characters: False 66 | ``` 67 | 68 | ### -url 69 | Deprecated parameter, please use Connect-SnipeitPS instead. 70 | URL of Snipeit system. 71 | 72 | ```yaml 73 | Type: String 74 | Parameter Sets: (All) 75 | Aliases: 76 | 77 | Required: False 78 | Position: 2 79 | Default value: None 80 | Accept pipeline input: False 81 | Accept wildcard characters: False 82 | ``` 83 | 84 | ### -Confirm 85 | Prompts you for confirmation before running the cmdlet. 86 | 87 | ```yaml 88 | Type: SwitchParameter 89 | Parameter Sets: (All) 90 | Aliases: cf 91 | 92 | Required: False 93 | Position: Named 94 | Default value: None 95 | Accept pipeline input: False 96 | Accept wildcard characters: False 97 | ``` 98 | 99 | ### -WhatIf 100 | Shows what would happen if the cmdlet runs. 101 | The cmdlet is not run. 102 | 103 | ```yaml 104 | Type: SwitchParameter 105 | Parameter Sets: (All) 106 | Aliases: wi 107 | 108 | Required: False 109 | Position: Named 110 | Default value: None 111 | Accept pipeline input: False 112 | Accept wildcard characters: False 113 | ``` 114 | 115 | ### CommonParameters 116 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 117 | 118 | ## INPUTS 119 | 120 | ## OUTPUTS 121 | 122 | ## NOTES 123 | 124 | ## RELATED LINKS 125 | -------------------------------------------------------------------------------- /docs/Remove-SnipeitLicense.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: SnipeitPS-help.xml 3 | Module Name: SnipeitPS 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Remove-SnipeitLicense 9 | 10 | ## SYNOPSIS 11 | Removes licence from Snipe-it asset system 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Remove-SnipeitLicense [-id] [[-url] ] [[-apiKey] ] [-WhatIf] [-Confirm] 17 | [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | Removes licence or multiple licenses from Snipe-it asset system 22 | 23 | ## EXAMPLES 24 | 25 | ### EXAMPLE 1 26 | ``` 27 | Remove-SnipeitLicence -ID 44 28 | ``` 29 | 30 | ### EXAMPLE 2 31 | ``` 32 | Get-SnipeitLicence -product_key 123456789 | Remove-SnipeitLicense 33 | ``` 34 | 35 | ## PARAMETERS 36 | 37 | ### -apiKey 38 | Deprecated parameter, please use Connect-SnipeitPS instead. 39 | User's API Key for Snipeit. 40 | 41 | ```yaml 42 | Type: String 43 | Parameter Sets: (All) 44 | Aliases: 45 | 46 | Required: False 47 | Position: 3 48 | Default value: None 49 | Accept pipeline input: False 50 | Accept wildcard characters: False 51 | ``` 52 | 53 | ### -id 54 | Unique ID For licence to be removed 55 | 56 | ```yaml 57 | Type: Int32[] 58 | Parameter Sets: (All) 59 | Aliases: 60 | 61 | Required: True 62 | Position: 1 63 | Default value: None 64 | Accept pipeline input: True (ByPropertyName) 65 | Accept wildcard characters: False 66 | ``` 67 | 68 | ### -url 69 | Deprecated parameter, please use Connect-SnipeitPS instead. 70 | URL of Snipeit system. 71 | 72 | ```yaml 73 | Type: String 74 | Parameter Sets: (All) 75 | Aliases: 76 | 77 | Required: False 78 | Position: 2 79 | Default value: None 80 | Accept pipeline input: False 81 | Accept wildcard characters: False 82 | ``` 83 | 84 | ### -Confirm 85 | Prompts you for confirmation before running the cmdlet. 86 | 87 | ```yaml 88 | Type: SwitchParameter 89 | Parameter Sets: (All) 90 | Aliases: cf 91 | 92 | Required: False 93 | Position: Named 94 | Default value: None 95 | Accept pipeline input: False 96 | Accept wildcard characters: False 97 | ``` 98 | 99 | ### -WhatIf 100 | Shows what would happen if the cmdlet runs. 101 | The cmdlet is not run. 102 | 103 | ```yaml 104 | Type: SwitchParameter 105 | Parameter Sets: (All) 106 | Aliases: wi 107 | 108 | Required: False 109 | Position: Named 110 | Default value: None 111 | Accept pipeline input: False 112 | Accept wildcard characters: False 113 | ``` 114 | 115 | ### CommonParameters 116 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 117 | 118 | ## INPUTS 119 | 120 | ## OUTPUTS 121 | 122 | ## NOTES 123 | 124 | ## RELATED LINKS 125 | -------------------------------------------------------------------------------- /docs/Remove-SnipeitLocation.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: SnipeitPS-help.xml 3 | Module Name: SnipeitPS 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Remove-SnipeitLocation 9 | 10 | ## SYNOPSIS 11 | Removes Location from Snipe-it asset system 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Remove-SnipeitLocation [-id] [[-url] ] [[-apiKey] ] [-WhatIf] [-Confirm] 17 | [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | Removes localtion or multiple locations from Snipe-it asset system 22 | 23 | ## EXAMPLES 24 | 25 | ### EXAMPLE 1 26 | ``` 27 | Remove-SnipeitLocation -ID 44 28 | ``` 29 | 30 | ### EXAMPLE 2 31 | ``` 32 | Get-SnipeitLocation -city Arkham | Remove-SnipeitLocation 33 | ``` 34 | 35 | ## PARAMETERS 36 | 37 | ### -apiKey 38 | Deprecated parameter, please use Connect-SnipeitPS instead. 39 | User's API Key for Snipeit. 40 | 41 | ```yaml 42 | Type: String 43 | Parameter Sets: (All) 44 | Aliases: 45 | 46 | Required: False 47 | Position: 3 48 | Default value: None 49 | Accept pipeline input: False 50 | Accept wildcard characters: False 51 | ``` 52 | 53 | ### -id 54 | Unique ID For location to be removed 55 | 56 | ```yaml 57 | Type: Int32[] 58 | Parameter Sets: (All) 59 | Aliases: 60 | 61 | Required: True 62 | Position: 1 63 | Default value: None 64 | Accept pipeline input: True (ByPropertyName) 65 | Accept wildcard characters: False 66 | ``` 67 | 68 | ### -url 69 | Deprecated parameter, please use Connect-SnipeitPS instead. 70 | URL of Snipeit system. 71 | 72 | ```yaml 73 | Type: String 74 | Parameter Sets: (All) 75 | Aliases: 76 | 77 | Required: False 78 | Position: 2 79 | Default value: None 80 | Accept pipeline input: False 81 | Accept wildcard characters: False 82 | ``` 83 | 84 | ### -Confirm 85 | Prompts you for confirmation before running the cmdlet. 86 | 87 | ```yaml 88 | Type: SwitchParameter 89 | Parameter Sets: (All) 90 | Aliases: cf 91 | 92 | Required: False 93 | Position: Named 94 | Default value: None 95 | Accept pipeline input: False 96 | Accept wildcard characters: False 97 | ``` 98 | 99 | ### -WhatIf 100 | Shows what would happen if the cmdlet runs. 101 | The cmdlet is not run. 102 | 103 | ```yaml 104 | Type: SwitchParameter 105 | Parameter Sets: (All) 106 | Aliases: wi 107 | 108 | Required: False 109 | Position: Named 110 | Default value: None 111 | Accept pipeline input: False 112 | Accept wildcard characters: False 113 | ``` 114 | 115 | ### CommonParameters 116 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 117 | 118 | ## INPUTS 119 | 120 | ## OUTPUTS 121 | 122 | ## NOTES 123 | 124 | ## RELATED LINKS 125 | -------------------------------------------------------------------------------- /docs/Remove-SnipeitManufacturer.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: SnipeitPS-help.xml 3 | Module Name: SnipeitPS 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Remove-SnipeitManufacturer 9 | 10 | ## SYNOPSIS 11 | Removes manufacturer from Snipe-it asset system 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Remove-SnipeitManufacturer [-id] [[-url] ] [[-apiKey] ] [-WhatIf] [-Confirm] 17 | [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | Removes manufacturer or multiple manufacturers from Snipe-it asset system 22 | 23 | ## EXAMPLES 24 | 25 | ### EXAMPLE 1 26 | ``` 27 | Remove-SnipeitManufacturer -ID 44 28 | ``` 29 | 30 | ### EXAMPLE 2 31 | ``` 32 | Get-SnipeitManufacturer | Where-object {$_.name -like '*something*'} | Remove-SnipeitManufacturer 33 | ``` 34 | 35 | ## PARAMETERS 36 | 37 | ### -apiKey 38 | Deprecated parameter, please use Connect-SnipeitPS instead. 39 | User's API Key for Snipeit. 40 | 41 | ```yaml 42 | Type: String 43 | Parameter Sets: (All) 44 | Aliases: 45 | 46 | Required: False 47 | Position: 3 48 | Default value: None 49 | Accept pipeline input: False 50 | Accept wildcard characters: False 51 | ``` 52 | 53 | ### -id 54 | Unique ID For manufacturer to be removed 55 | 56 | ```yaml 57 | Type: Int32[] 58 | Parameter Sets: (All) 59 | Aliases: 60 | 61 | Required: True 62 | Position: 1 63 | Default value: None 64 | Accept pipeline input: True (ByPropertyName) 65 | Accept wildcard characters: False 66 | ``` 67 | 68 | ### -url 69 | Deprecated parameter, please use Connect-SnipeitPS instead. 70 | URL of Snipeit system. 71 | 72 | ```yaml 73 | Type: String 74 | Parameter Sets: (All) 75 | Aliases: 76 | 77 | Required: False 78 | Position: 2 79 | Default value: None 80 | Accept pipeline input: False 81 | Accept wildcard characters: False 82 | ``` 83 | 84 | ### -Confirm 85 | Prompts you for confirmation before running the cmdlet. 86 | 87 | ```yaml 88 | Type: SwitchParameter 89 | Parameter Sets: (All) 90 | Aliases: cf 91 | 92 | Required: False 93 | Position: Named 94 | Default value: None 95 | Accept pipeline input: False 96 | Accept wildcard characters: False 97 | ``` 98 | 99 | ### -WhatIf 100 | Shows what would happen if the cmdlet runs. 101 | The cmdlet is not run. 102 | 103 | ```yaml 104 | Type: SwitchParameter 105 | Parameter Sets: (All) 106 | Aliases: wi 107 | 108 | Required: False 109 | Position: Named 110 | Default value: None 111 | Accept pipeline input: False 112 | Accept wildcard characters: False 113 | ``` 114 | 115 | ### CommonParameters 116 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 117 | 118 | ## INPUTS 119 | 120 | ## OUTPUTS 121 | 122 | ## NOTES 123 | 124 | ## RELATED LINKS 125 | -------------------------------------------------------------------------------- /docs/Remove-SnipeitModel.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: SnipeitPS-help.xml 3 | Module Name: SnipeitPS 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Remove-SnipeitModel 9 | 10 | ## SYNOPSIS 11 | Removes Asset model from Snipe-it asset system 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Remove-SnipeitModel [-id] [[-url] ] [[-apiKey] ] [-WhatIf] [-Confirm] 17 | [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | Removes asset model or multiple assets models from Snipe-it asset system 22 | 23 | ## EXAMPLES 24 | 25 | ### EXAMPLE 1 26 | ``` 27 | Remove-SnipeitModel -ID 44 28 | ``` 29 | 30 | ### EXAMPLE 2 31 | ``` 32 | Get-SnipeitModel -search needle | Remove-SnipeitModel 33 | ``` 34 | 35 | ## PARAMETERS 36 | 37 | ### -apiKey 38 | Deprecated parameter, please use Connect-SnipeitPS instead. 39 | User's API Key for Snipeit. 40 | 41 | ```yaml 42 | Type: String 43 | Parameter Sets: (All) 44 | Aliases: 45 | 46 | Required: False 47 | Position: 3 48 | Default value: None 49 | Accept pipeline input: False 50 | Accept wildcard characters: False 51 | ``` 52 | 53 | ### -id 54 | Unique ID For Model to be removed 55 | 56 | ```yaml 57 | Type: Int32[] 58 | Parameter Sets: (All) 59 | Aliases: 60 | 61 | Required: True 62 | Position: 1 63 | Default value: None 64 | Accept pipeline input: True (ByPropertyName) 65 | Accept wildcard characters: False 66 | ``` 67 | 68 | ### -url 69 | Deprecated parameter, please use Connect-SnipeitPS instead. 70 | URL of Snipeit system. 71 | 72 | ```yaml 73 | Type: String 74 | Parameter Sets: (All) 75 | Aliases: 76 | 77 | Required: False 78 | Position: 2 79 | Default value: None 80 | Accept pipeline input: False 81 | Accept wildcard characters: False 82 | ``` 83 | 84 | ### -Confirm 85 | Prompts you for confirmation before running the cmdlet. 86 | 87 | ```yaml 88 | Type: SwitchParameter 89 | Parameter Sets: (All) 90 | Aliases: cf 91 | 92 | Required: False 93 | Position: Named 94 | Default value: None 95 | Accept pipeline input: False 96 | Accept wildcard characters: False 97 | ``` 98 | 99 | ### -WhatIf 100 | Shows what would happen if the cmdlet runs. 101 | The cmdlet is not run. 102 | 103 | ```yaml 104 | Type: SwitchParameter 105 | Parameter Sets: (All) 106 | Aliases: wi 107 | 108 | Required: False 109 | Position: Named 110 | Default value: None 111 | Accept pipeline input: False 112 | Accept wildcard characters: False 113 | ``` 114 | 115 | ### CommonParameters 116 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 117 | 118 | ## INPUTS 119 | 120 | ## OUTPUTS 121 | 122 | ## NOTES 123 | 124 | ## RELATED LINKS 125 | -------------------------------------------------------------------------------- /docs/Remove-SnipeitSupplier.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: SnipeitPS-help.xml 3 | Module Name: SnipeitPS 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Remove-SnipeitSupplier 9 | 10 | ## SYNOPSIS 11 | Removes supplier from Snipe-it asset system 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Remove-SnipeitSupplier [-id] [[-url] ] [[-apiKey] ] [-WhatIf] [-Confirm] 17 | [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | Removes supplier or multiple manufacturers from Snipe-it asset system 22 | 23 | ## EXAMPLES 24 | 25 | ### EXAMPLE 1 26 | ``` 27 | Remove-SnipeitSupplier -ID 44 28 | ``` 29 | 30 | ### EXAMPLE 2 31 | ``` 32 | Get-SnipeitSupplier | Where-object {$_.name -like '*something*'} | Remove-SnipeitSupplier 33 | ``` 34 | 35 | ## PARAMETERS 36 | 37 | ### -apiKey 38 | Deprecated parameter, please use Connect-SnipeitPS instead. 39 | User's API Key for Snipeit. 40 | 41 | ```yaml 42 | Type: String 43 | Parameter Sets: (All) 44 | Aliases: 45 | 46 | Required: False 47 | Position: 3 48 | Default value: None 49 | Accept pipeline input: False 50 | Accept wildcard characters: False 51 | ``` 52 | 53 | ### -id 54 | Unique ID For supplier to be removed 55 | 56 | ```yaml 57 | Type: Int32[] 58 | Parameter Sets: (All) 59 | Aliases: 60 | 61 | Required: True 62 | Position: 1 63 | Default value: None 64 | Accept pipeline input: True (ByPropertyName) 65 | Accept wildcard characters: False 66 | ``` 67 | 68 | ### -url 69 | Deprecated parameter, please use Connect-SnipeitPS instead. 70 | URL of Snipeit system. 71 | 72 | ```yaml 73 | Type: String 74 | Parameter Sets: (All) 75 | Aliases: 76 | 77 | Required: False 78 | Position: 2 79 | Default value: None 80 | Accept pipeline input: False 81 | Accept wildcard characters: False 82 | ``` 83 | 84 | ### -Confirm 85 | Prompts you for confirmation before running the cmdlet. 86 | 87 | ```yaml 88 | Type: SwitchParameter 89 | Parameter Sets: (All) 90 | Aliases: cf 91 | 92 | Required: False 93 | Position: Named 94 | Default value: None 95 | Accept pipeline input: False 96 | Accept wildcard characters: False 97 | ``` 98 | 99 | ### -WhatIf 100 | Shows what would happen if the cmdlet runs. 101 | The cmdlet is not run. 102 | 103 | ```yaml 104 | Type: SwitchParameter 105 | Parameter Sets: (All) 106 | Aliases: wi 107 | 108 | Required: False 109 | Position: Named 110 | Default value: None 111 | Accept pipeline input: False 112 | Accept wildcard characters: False 113 | ``` 114 | 115 | ### CommonParameters 116 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 117 | 118 | ## INPUTS 119 | 120 | ## OUTPUTS 121 | 122 | ## NOTES 123 | 124 | ## RELATED LINKS 125 | -------------------------------------------------------------------------------- /docs/Remove-SnipeitUser.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: SnipeitPS-help.xml 3 | Module Name: SnipeitPS 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Remove-SnipeitUser 9 | 10 | ## SYNOPSIS 11 | Removes User from Snipe-it asset system 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Remove-SnipeitUser [-id] [[-url] ] [[-apiKey] ] [-WhatIf] [-Confirm] 17 | [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | Removes Uuser or users from Snipe-it asset system 22 | 23 | ## EXAMPLES 24 | 25 | ### EXAMPLE 1 26 | ``` 27 | Remove-SnipeitUser -ID 44 -url $url -apiKey $secret -Verbose 28 | ``` 29 | 30 | ## PARAMETERS 31 | 32 | ### -apiKey 33 | Deprecated parameter, please use Connect-SnipeitPS instead. 34 | User's API Key for Snipeit. 35 | 36 | ```yaml 37 | Type: String 38 | Parameter Sets: (All) 39 | Aliases: 40 | 41 | Required: False 42 | Position: 3 43 | Default value: None 44 | Accept pipeline input: False 45 | Accept wildcard characters: False 46 | ``` 47 | 48 | ### -id 49 | Unique ID For User to be removed 50 | 51 | ```yaml 52 | Type: Int32[] 53 | Parameter Sets: (All) 54 | Aliases: 55 | 56 | Required: True 57 | Position: 1 58 | Default value: None 59 | Accept pipeline input: True (ByPropertyName) 60 | Accept wildcard characters: False 61 | ``` 62 | 63 | ### -url 64 | Deprecated parameter, please use Connect-SnipeitPS instead. 65 | URL of Snipeit system. 66 | 67 | ```yaml 68 | Type: String 69 | Parameter Sets: (All) 70 | Aliases: 71 | 72 | Required: False 73 | Position: 2 74 | Default value: None 75 | Accept pipeline input: False 76 | Accept wildcard characters: False 77 | ``` 78 | 79 | ### -Confirm 80 | Prompts you for confirmation before running the cmdlet. 81 | 82 | ```yaml 83 | Type: SwitchParameter 84 | Parameter Sets: (All) 85 | Aliases: cf 86 | 87 | Required: False 88 | Position: Named 89 | Default value: None 90 | Accept pipeline input: False 91 | Accept wildcard characters: False 92 | ``` 93 | 94 | ### -WhatIf 95 | Shows what would happen if the cmdlet runs. 96 | The cmdlet is not run. 97 | 98 | ```yaml 99 | Type: SwitchParameter 100 | Parameter Sets: (All) 101 | Aliases: wi 102 | 103 | Required: False 104 | Position: Named 105 | Default value: None 106 | Accept pipeline input: False 107 | Accept wildcard characters: False 108 | ``` 109 | 110 | ### CommonParameters 111 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 112 | 113 | ## INPUTS 114 | 115 | ## OUTPUTS 116 | 117 | ## NOTES 118 | 119 | ## RELATED LINKS 120 | -------------------------------------------------------------------------------- /docs/Reset-SnipeitAccessoryOwner.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: SnipeitPS-help.xml 3 | Module Name: SnipeitPS 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Reset-SnipeitAccessoryOwner 9 | 10 | ## SYNOPSIS 11 | Checkin accessories 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Reset-SnipeitAccessoryOwner [-assigned_pivot_id] [[-url] ] [[-apiKey] ] [-WhatIf] 17 | [-Confirm] [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | Checkin accessories 22 | 23 | ## EXAMPLES 24 | 25 | ### EXAMPLE 1 26 | ``` 27 | To get the accessories_users table for specific accessory id number 28 | ``` 29 | 30 | Get-SnipeitAccessoryOwner -id 1 31 | 32 | Thenselect assigned_pivot_id for userid you like check in 33 | 34 | Get-SnipeitAccessoryOwner -assigned_pivot_id xxx 35 | 36 | ## PARAMETERS 37 | 38 | ### -apiKey 39 | Deprecated parameter, please use Connect-SnipeitPS instead. 40 | User's API Key for Snipeit. 41 | 42 | ```yaml 43 | Type: String 44 | Parameter Sets: (All) 45 | Aliases: 46 | 47 | Required: False 48 | Position: 3 49 | Default value: None 50 | Accept pipeline input: False 51 | Accept wildcard characters: False 52 | ``` 53 | 54 | ### -assigned_pivot_id 55 | This is the assigned_pivot_id of the accessory+user relationships in the accessories_users table 56 | Use Get-SnipeitAccessoryOwner to find out nooded value 57 | 58 | ```yaml 59 | Type: Int32 60 | Parameter Sets: (All) 61 | Aliases: 62 | 63 | Required: True 64 | Position: 1 65 | Default value: 0 66 | Accept pipeline input: False 67 | Accept wildcard characters: False 68 | ``` 69 | 70 | ### -url 71 | Deprecated parameter, please use Connect-SnipeitPS instead. 72 | URL of Snipeit system. 73 | 74 | ```yaml 75 | Type: String 76 | Parameter Sets: (All) 77 | Aliases: 78 | 79 | Required: False 80 | Position: 2 81 | Default value: None 82 | Accept pipeline input: False 83 | Accept wildcard characters: False 84 | ``` 85 | 86 | ### -Confirm 87 | Prompts you for confirmation before running the cmdlet. 88 | 89 | ```yaml 90 | Type: SwitchParameter 91 | Parameter Sets: (All) 92 | Aliases: cf 93 | 94 | Required: False 95 | Position: Named 96 | Default value: None 97 | Accept pipeline input: False 98 | Accept wildcard characters: False 99 | ``` 100 | 101 | ### -WhatIf 102 | Shows what would happen if the cmdlet runs. 103 | The cmdlet is not run. 104 | 105 | ```yaml 106 | Type: SwitchParameter 107 | Parameter Sets: (All) 108 | Aliases: wi 109 | 110 | Required: False 111 | Position: Named 112 | Default value: None 113 | Accept pipeline input: False 114 | Accept wildcard characters: False 115 | ``` 116 | 117 | ### CommonParameters 118 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 119 | 120 | ## INPUTS 121 | 122 | ## OUTPUTS 123 | 124 | ## NOTES 125 | 126 | ## RELATED LINKS 127 | -------------------------------------------------------------------------------- /docs/Reset-SnipeitAssetOwner.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: SnipeitPS-help.xml 3 | Module Name: SnipeitPS 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Reset-SnipeitAssetOwner 9 | 10 | ## SYNOPSIS 11 | Checkin asset 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Reset-SnipeitAssetOwner [-id] [[-status_id] ] [[-location_id] ] [[-note] ] 17 | [[-url] ] [[-apiKey] ] [-WhatIf] [-Confirm] [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | Checks asset in from current user/localtion/asset 22 | 23 | ## EXAMPLES 24 | 25 | ### EXAMPLE 1 26 | ``` 27 | Remove-SnipeitUser -ID 44 28 | ``` 29 | 30 | ## PARAMETERS 31 | 32 | ### -apiKey 33 | Deprecated parameter, please use Connect-SnipeitPS instead. 34 | User's API Key for Snipeit. 35 | 36 | ```yaml 37 | Type: String 38 | Parameter Sets: (All) 39 | Aliases: 40 | 41 | Required: False 42 | Position: 6 43 | Default value: None 44 | Accept pipeline input: False 45 | Accept wildcard characters: False 46 | ``` 47 | 48 | ### -id 49 | Unique ID For asset to checkin 50 | 51 | ```yaml 52 | Type: Int32 53 | Parameter Sets: (All) 54 | Aliases: 55 | 56 | Required: True 57 | Position: 1 58 | Default value: 0 59 | Accept pipeline input: False 60 | Accept wildcard characters: False 61 | ``` 62 | 63 | ### -location_id 64 | Location id to change asset location to 65 | 66 | ```yaml 67 | Type: Int32 68 | Parameter Sets: (All) 69 | Aliases: 70 | 71 | Required: False 72 | Position: 3 73 | Default value: 0 74 | Accept pipeline input: False 75 | Accept wildcard characters: False 76 | ``` 77 | 78 | ### -note 79 | Notes about checkin 80 | 81 | ```yaml 82 | Type: String 83 | Parameter Sets: (All) 84 | Aliases: 85 | 86 | Required: False 87 | Position: 4 88 | Default value: None 89 | Accept pipeline input: False 90 | Accept wildcard characters: False 91 | ``` 92 | 93 | ### -status_id 94 | Change asset status to 95 | 96 | ```yaml 97 | Type: Int32 98 | Parameter Sets: (All) 99 | Aliases: 100 | 101 | Required: False 102 | Position: 2 103 | Default value: 0 104 | Accept pipeline input: False 105 | Accept wildcard characters: False 106 | ``` 107 | 108 | ### -url 109 | Deprecated parameter, please use Connect-SnipeitPS instead. 110 | URL of Snipeit system. 111 | 112 | ```yaml 113 | Type: String 114 | Parameter Sets: (All) 115 | Aliases: 116 | 117 | Required: False 118 | Position: 5 119 | Default value: None 120 | Accept pipeline input: False 121 | Accept wildcard characters: False 122 | ``` 123 | 124 | ### -Confirm 125 | Prompts you for confirmation before running the cmdlet. 126 | 127 | ```yaml 128 | Type: SwitchParameter 129 | Parameter Sets: (All) 130 | Aliases: cf 131 | 132 | Required: False 133 | Position: Named 134 | Default value: None 135 | Accept pipeline input: False 136 | Accept wildcard characters: False 137 | ``` 138 | 139 | ### -WhatIf 140 | Shows what would happen if the cmdlet runs. 141 | The cmdlet is not run. 142 | 143 | ```yaml 144 | Type: SwitchParameter 145 | Parameter Sets: (All) 146 | Aliases: wi 147 | 148 | Required: False 149 | Position: Named 150 | Default value: None 151 | Accept pipeline input: False 152 | Accept wildcard characters: False 153 | ``` 154 | 155 | ### CommonParameters 156 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 157 | 158 | ## INPUTS 159 | 160 | ## OUTPUTS 161 | 162 | ## NOTES 163 | 164 | ## RELATED LINKS 165 | -------------------------------------------------------------------------------- /docs/Set-SnipeitAccessoryOwner.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: SnipeitPS-help.xml 3 | Module Name: SnipeitPS 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Set-SnipeitAccessoryOwner 9 | 10 | ## SYNOPSIS 11 | Checkout accessory 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Set-SnipeitAccessoryOwner [-id] [-assigned_to] [[-note] ] [[-url] ] 17 | [[-apiKey] ] [-WhatIf] [-Confirm] [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | Checkout accessory to user 22 | 23 | ## EXAMPLES 24 | 25 | ### EXAMPLE 1 26 | ``` 27 | Set-SnipeitAccessoryOwner -id 1 -assigned_id 1 -note "testing check out to user" 28 | ``` 29 | 30 | ## PARAMETERS 31 | 32 | ### -apiKey 33 | Deprecated parameter, please use Connect-SnipeitPS instead. 34 | User's API Key for Snipeit. 35 | 36 | ```yaml 37 | Type: String 38 | Parameter Sets: (All) 39 | Aliases: 40 | 41 | Required: False 42 | Position: 5 43 | Default value: None 44 | Accept pipeline input: False 45 | Accept wildcard characters: False 46 | ``` 47 | 48 | ### -assigned_to 49 | {{ Fill assigned_to Description }} 50 | 51 | ```yaml 52 | Type: Int32 53 | Parameter Sets: (All) 54 | Aliases: 55 | 56 | Required: True 57 | Position: 2 58 | Default value: 0 59 | Accept pipeline input: False 60 | Accept wildcard characters: False 61 | ``` 62 | 63 | ### -id 64 | Unique ID For accessory or array of IDs to checkout 65 | 66 | ```yaml 67 | Type: Int32[] 68 | Parameter Sets: (All) 69 | Aliases: 70 | 71 | Required: True 72 | Position: 1 73 | Default value: None 74 | Accept pipeline input: True (ByPropertyName) 75 | Accept wildcard characters: False 76 | ``` 77 | 78 | ### -note 79 | Notes about checkout 80 | 81 | ```yaml 82 | Type: String 83 | Parameter Sets: (All) 84 | Aliases: 85 | 86 | Required: False 87 | Position: 3 88 | Default value: None 89 | Accept pipeline input: False 90 | Accept wildcard characters: False 91 | ``` 92 | 93 | ### -url 94 | Deprecated parameter, please use Connect-SnipeitPS instead. 95 | URL of Snipeit system. 96 | 97 | ```yaml 98 | Type: String 99 | Parameter Sets: (All) 100 | Aliases: 101 | 102 | Required: False 103 | Position: 4 104 | Default value: None 105 | Accept pipeline input: False 106 | Accept wildcard characters: False 107 | ``` 108 | 109 | ### -Confirm 110 | Prompts you for confirmation before running the cmdlet. 111 | 112 | ```yaml 113 | Type: SwitchParameter 114 | Parameter Sets: (All) 115 | Aliases: cf 116 | 117 | Required: False 118 | Position: Named 119 | Default value: None 120 | Accept pipeline input: False 121 | Accept wildcard characters: False 122 | ``` 123 | 124 | ### -WhatIf 125 | Shows what would happen if the cmdlet runs. 126 | The cmdlet is not run. 127 | 128 | ```yaml 129 | Type: SwitchParameter 130 | Parameter Sets: (All) 131 | Aliases: wi 132 | 133 | Required: False 134 | Position: Named 135 | Default value: None 136 | Accept pipeline input: False 137 | Accept wildcard characters: False 138 | ``` 139 | 140 | ### CommonParameters 141 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 142 | 143 | ## INPUTS 144 | 145 | ## OUTPUTS 146 | 147 | ## NOTES 148 | 149 | ## RELATED LINKS 150 | -------------------------------------------------------------------------------- /docs/Set-SnipeitInfo.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: SnipeitPS-help.xml 3 | Module Name: SnipeitPS 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Set-SnipeitInfo 9 | 10 | ## SYNOPSIS 11 | Sets authetication information. 12 | Deprecated, use Connect-SnipeitPS instead. 13 | 14 | ## SYNTAX 15 | 16 | ``` 17 | Set-SnipeitInfo [-url] [-apiKey] [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | Deprecated combatibilty function that Set apikey and url user to connect Snipe-It system. 22 | Please use Connect-SnipeitPS instead. 23 | 24 | ## EXAMPLES 25 | 26 | ### EXAMPLE 1 27 | ``` 28 | Set-SnipeitInfo -url $url -apiKey -Verbose 29 | ``` 30 | 31 | ## PARAMETERS 32 | 33 | ### -apiKey 34 | User's API Key for Snipeit. 35 | 36 | ```yaml 37 | Type: String 38 | Parameter Sets: (All) 39 | Aliases: 40 | 41 | Required: True 42 | Position: 2 43 | Default value: None 44 | Accept pipeline input: False 45 | Accept wildcard characters: False 46 | ``` 47 | 48 | ### -url 49 | URL of Snipeit system. 50 | 51 | ```yaml 52 | Type: Uri 53 | Parameter Sets: (All) 54 | Aliases: 55 | 56 | Required: True 57 | Position: 1 58 | Default value: None 59 | Accept pipeline input: False 60 | Accept wildcard characters: False 61 | ``` 62 | 63 | ### CommonParameters 64 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 65 | 66 | ## INPUTS 67 | 68 | ## OUTPUTS 69 | 70 | ## NOTES 71 | 72 | ## RELATED LINKS 73 | -------------------------------------------------------------------------------- /docs/Set-SnipeitManufacturer.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: SnipeitPS-help.xml 3 | Module Name: SnipeitPS 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Set-SnipeitManufacturer 9 | 10 | ## SYNOPSIS 11 | Add a new Manufacturer to Snipe-it asset system 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Set-SnipeitManufacturer [-Name] [[-image] ] [-image_delete] [[-RequestType] ] 17 | [[-url] ] [[-apiKey] ] [-WhatIf] [-Confirm] [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | Long description 22 | 23 | ## EXAMPLES 24 | 25 | ### EXAMPLE 1 26 | ``` 27 | New-SnipeitManufacturer -name "HP" 28 | ``` 29 | 30 | ## PARAMETERS 31 | 32 | ### -apiKey 33 | Deprecated parameter, please use Connect-SnipeitPS instead. 34 | Users API Key for Snipeit. 35 | 36 | ```yaml 37 | Type: String 38 | Parameter Sets: (All) 39 | Aliases: 40 | 41 | Required: False 42 | Position: 5 43 | Default value: None 44 | Accept pipeline input: False 45 | Accept wildcard characters: False 46 | ``` 47 | 48 | ### -image 49 | Image file name and path for item 50 | 51 | ```yaml 52 | Type: String 53 | Parameter Sets: (All) 54 | Aliases: 55 | 56 | Required: False 57 | Position: 2 58 | Default value: None 59 | Accept pipeline input: False 60 | Accept wildcard characters: False 61 | ``` 62 | 63 | ### -image_delete 64 | Remove current image 65 | 66 | ```yaml 67 | Type: SwitchParameter 68 | Parameter Sets: (All) 69 | Aliases: 70 | 71 | Required: False 72 | Position: Named 73 | Default value: False 74 | Accept pipeline input: False 75 | Accept wildcard characters: False 76 | ``` 77 | 78 | ### -Name 79 | Name of the Manufacturer 80 | 81 | ```yaml 82 | Type: String 83 | Parameter Sets: (All) 84 | Aliases: 85 | 86 | Required: True 87 | Position: 1 88 | Default value: None 89 | Accept pipeline input: False 90 | Accept wildcard characters: False 91 | ``` 92 | 93 | ### -RequestType 94 | Http request type to send Snipe IT system. 95 | Defaults to Patch you could use Put if needed. 96 | 97 | ```yaml 98 | Type: String 99 | Parameter Sets: (All) 100 | Aliases: 101 | 102 | Required: False 103 | Position: 3 104 | Default value: Patch 105 | Accept pipeline input: False 106 | Accept wildcard characters: False 107 | ``` 108 | 109 | ### -url 110 | Deprecated parameter, please use Connect-SnipeitPS instead. 111 | URL of Snipeit system. 112 | 113 | ```yaml 114 | Type: String 115 | Parameter Sets: (All) 116 | Aliases: 117 | 118 | Required: False 119 | Position: 4 120 | Default value: None 121 | Accept pipeline input: False 122 | Accept wildcard characters: False 123 | ``` 124 | 125 | ### -Confirm 126 | Prompts you for confirmation before running the cmdlet. 127 | 128 | ```yaml 129 | Type: SwitchParameter 130 | Parameter Sets: (All) 131 | Aliases: cf 132 | 133 | Required: False 134 | Position: Named 135 | Default value: None 136 | Accept pipeline input: False 137 | Accept wildcard characters: False 138 | ``` 139 | 140 | ### -WhatIf 141 | Shows what would happen if the cmdlet runs. 142 | The cmdlet is not run. 143 | 144 | ```yaml 145 | Type: SwitchParameter 146 | Parameter Sets: (All) 147 | Aliases: wi 148 | 149 | Required: False 150 | Position: Named 151 | Default value: None 152 | Accept pipeline input: False 153 | Accept wildcard characters: False 154 | ``` 155 | 156 | ### CommonParameters 157 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 158 | 159 | ## INPUTS 160 | 161 | ## OUTPUTS 162 | 163 | ## NOTES 164 | 165 | ## RELATED LINKS 166 | -------------------------------------------------------------------------------- /docs/Update-SnipeitAlias.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: SnipeitPS-help.xml 3 | Module Name: SnipeitPS 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Update-SnipeitAlias 9 | 10 | ## SYNOPSIS 11 | Replaces old SnipeitPS commands with new ones 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | Update-SnipeitAlias [-String] [-WhatIf] [-Confirm] [] 17 | ``` 18 | 19 | ## DESCRIPTION 20 | Replaces old SnipeitPS commands with new ones 21 | 22 | ## EXAMPLES 23 | 24 | ### EXAMPLE 1 25 | ``` 26 | Get-Content [your-script.ps1] | Update-SnipeitAlias | Out-File [new-script-name.ps1] 27 | ``` 28 | 29 | Replaces old command from file "your-script.ps1" and creates new script "new-script-name.ps1" 30 | After testing new file you can replace old file with new. 31 | 32 | ## PARAMETERS 33 | 34 | ### -String 35 | Input string 36 | 37 | ```yaml 38 | Type: String[] 39 | Parameter Sets: (All) 40 | Aliases: 41 | 42 | Required: True 43 | Position: 1 44 | Default value: None 45 | Accept pipeline input: True (ByValue) 46 | Accept wildcard characters: False 47 | ``` 48 | 49 | ### -Confirm 50 | Prompts you for confirmation before running the cmdlet. 51 | 52 | ```yaml 53 | Type: SwitchParameter 54 | Parameter Sets: (All) 55 | Aliases: cf 56 | 57 | Required: False 58 | Position: Named 59 | Default value: None 60 | Accept pipeline input: False 61 | Accept wildcard characters: False 62 | ``` 63 | 64 | ### -WhatIf 65 | Shows what would happen if the cmdlet runs. 66 | The cmdlet is not run. 67 | 68 | ```yaml 69 | Type: SwitchParameter 70 | Parameter Sets: (All) 71 | Aliases: wi 72 | 73 | Required: False 74 | Position: Named 75 | Default value: None 76 | Accept pipeline input: False 77 | Accept wildcard characters: False 78 | ``` 79 | 80 | ### CommonParameters 81 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 82 | 83 | ## INPUTS 84 | 85 | ## OUTPUTS 86 | 87 | ## NOTES 88 | 89 | ## RELATED LINKS 90 | -------------------------------------------------------------------------------- /docs/_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-architect -------------------------------------------------------------------------------- /docs/about_SnipeitPS.md: -------------------------------------------------------------------------------- 1 | # About SnipeitPS 2 | ## about_SnipeitPS 3 | 4 | # SHORT DESCRIPTION 5 | Powershell API Wrapper for Snipe-it. 6 | 7 | # LONG DESCRIPTION 8 | Collection of tools that makes interacting with Snipe-it api more pleasant. 9 | 10 | # EXAMPLES 11 | Prepare connection Snipe-It with: 12 | 13 | Connect-SnipeitPS -url https://your.site -apikey YourVeryLongApiKey.... 14 | 15 | For secure ways to pass apikey to script, see Get-Help Connect-SnipeitPS -full 16 | 17 | To search assets use: 18 | 19 | Get-SnipeitAsset -search needle 20 | 21 | Piping get and new commands results to set commands is supported. Followirg will 22 | set notes for every asset that have model_id 123. 23 | 24 | Get-SnipeitAsset -model_id 123 -all | Set-SnipeitAsset 25 | 26 | You can get specific items with -id prameter like 27 | 28 | Get-SnipeitModel -id 123 29 | 30 | # NOTE 31 | Most of commands are using same parameters as in Snipe It api, 32 | but it's always good idea check syntax with Get-Help 33 | 34 | # TROUBLESHOOTING NOTE 35 | Check your api key and certificate on server first. 36 | 37 | # SEE ALSO 38 | 39 | Report any issues to: 40 | [GitHub project page](https://github.com/snazy2000/SnipeitPS/issues) 41 | 42 | # KEYWORDS 43 | 44 | - Snipe-It 45 | - asset management 46 | --------------------------------------------------------------------------------