mirror of
https://github.com/snazy2000/SnipeitPS.git
synced 2025-12-15 02:35:47 +00:00
commit
fbef90ee79
160 changed files with 3746 additions and 2079 deletions
18
CHANGELOG.md
18
CHANGELOG.md
|
|
@ -5,6 +5,24 @@ All notable changes to this project will be documented in this file.
|
||||||
The format is based on [Keep a Changelog](http://keepachangelog.com/),
|
The format is based on [Keep a Changelog](http://keepachangelog.com/),
|
||||||
and this project adheres to [Semantic Versioning](http://semver.org/).
|
and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||||
|
|
||||||
|
# [v.1.10.x] - 2021-09-03
|
||||||
|
|
||||||
|
## New secure ways to connect Snipe it
|
||||||
|
|
||||||
|
### -secureApiKey allow pass apiKey as SecureString
|
||||||
|
Connect-SnipeitPS -URL 'https://asset.example.com' -secureApiKey 'tokenKey'
|
||||||
|
|
||||||
|
### Set connection with safely saved credentials, first save credentials
|
||||||
|
$SnipeCred= Get-Credential -message "Use url as username and apikey as password"
|
||||||
|
$SnipeCred | Export-CliXml snipecred.xml
|
||||||
|
|
||||||
|
### ..then use your saved credentials like
|
||||||
|
Connect-SnipeitPS -siteCred (Import-CliXml snipecred.xml)
|
||||||
|
|
||||||
|
## Fix for content encoding in invoke-snipeitmethod
|
||||||
|
Version 1.9 introduced bug that converted non ascii characters to ascii
|
||||||
|
during request.
|
||||||
|
|
||||||
# [v.1.9.x] - 2021-07-14
|
# [v.1.9.x] - 2021-07-14
|
||||||
|
|
||||||
## Image uploads
|
## Image uploads
|
||||||
|
|
|
||||||
18
README.md
18
README.md
|
|
@ -19,9 +19,23 @@ Install-Module SnipeitPS
|
||||||
# Check for updates occasionally:
|
# Check for updates occasionally:
|
||||||
Update-Module SnipeitPS
|
Update-Module SnipeitPS
|
||||||
|
|
||||||
# To use each session:
|
# import module to session:
|
||||||
Import-Module SnipeitPS
|
Import-Module SnipeitPS
|
||||||
Set-SnipeitInfo -URL 'https://asset.example.com' -apiKey 'tokenKey'
|
|
||||||
|
# Set connection
|
||||||
|
Connect-SnipeitPS -URL 'https://asset.example.com' -apiKey 'tokenKey'
|
||||||
|
|
||||||
|
# Or set connection with safely saved credentials, first save credentials
|
||||||
|
$SnipeCred =Get-Credential -message "Use url as username and apikey as password"
|
||||||
|
$SnipeCred | Export-CliXml snipecred.xml
|
||||||
|
|
||||||
|
# ..then use your saved credentials like
|
||||||
|
Connect-SnipeitPS -siteCred (Import-CliXml snipecred.xml)
|
||||||
|
|
||||||
|
# OR use -secureApiKey that allow pass apiKey as SecureString
|
||||||
|
# if you are usin Microsoft.PowerShell.SecretManagement or like
|
||||||
|
Connect-SnipeitPS -URL 'https://asset.example.com' -secureApiKey 'tokenKey'
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Usage
|
### Usage
|
||||||
|
|
|
||||||
|
|
@ -1,31 +1,54 @@
|
||||||
function Invoke-SnipeitMethod {
|
<#
|
||||||
<#
|
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Extracted invokation of the REST method to own function.
|
Make api request to Snipe it
|
||||||
#>
|
|
||||||
|
.PARAMETER Api
|
||||||
|
Api part of url. prefix with slash ie. "/api/v1/hardware"
|
||||||
|
|
||||||
|
.PARAMETER Method
|
||||||
|
Method of the invokation, one of following "GET", "POST", "PUT", "PATCH" or "DELETE"
|
||||||
|
|
||||||
|
.PARAMETER Body
|
||||||
|
Request body as hashtable. Needed for post, put and patch
|
||||||
|
|
||||||
|
.PARAMETER GetParameters
|
||||||
|
Get-Parameters as hastable.
|
||||||
|
#>
|
||||||
|
|
||||||
|
function Invoke-SnipeitMethod {
|
||||||
[OutputType(
|
[OutputType(
|
||||||
[PSObject]
|
[PSObject]
|
||||||
)]
|
)]
|
||||||
param (
|
|
||||||
# REST API to invoke
|
|
||||||
[Parameter(Mandatory = $true)]
|
|
||||||
[Uri]$URi,
|
|
||||||
|
|
||||||
# Method of the invokation
|
param (
|
||||||
|
|
||||||
|
[Parameter(Mandatory = $true)]
|
||||||
|
[string]$Api,
|
||||||
|
|
||||||
[ValidateSet("GET", "POST", "PUT", "PATCH", "DELETE")]
|
[ValidateSet("GET", "POST", "PUT", "PATCH", "DELETE")]
|
||||||
[string]$Method = "GET",
|
[string]$Method = "GET",
|
||||||
|
|
||||||
# Body of the request
|
|
||||||
[Hashtable]$Body,
|
[Hashtable]$Body,
|
||||||
|
|
||||||
[string] $Token,
|
|
||||||
|
|
||||||
# GET Parameters
|
|
||||||
[Hashtable]$GetParameters
|
[Hashtable]$GetParameters
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
BEGIN {
|
BEGIN {
|
||||||
|
#use legacy per command based url and apikey
|
||||||
|
if ( $null -ne $SnipeitPSSession.legacyUrl -and $null -ne $SnipeitPSSession.legacyApiKey ) {
|
||||||
|
[string]$Url = $SnipeitPSSession.legacyUrl
|
||||||
|
Write-Debug "Invoke-SnipeitMethod url: $Url"
|
||||||
|
$Token = ConvertFrom-SecureString -AsPlainText -SecureString $SnipeitPSSession.legacyApiKey
|
||||||
|
|
||||||
|
} elseif ($null -ne $SnipeitPSSession.url -and $null -ne $SnipeitPSSession.apiKey) {
|
||||||
|
[string]$Url = $SnipeitPSSession.url
|
||||||
|
Write-Debug "Invoke-SnipeitMethod url: $Url"
|
||||||
|
$Token = ConvertFrom-SecureString -AsPlainText -SecureString $SnipeitPSSession.apiKey
|
||||||
|
|
||||||
|
} else {
|
||||||
|
throw "Please use Connect-SnipeitPS to setup connection before any other commands."
|
||||||
|
}
|
||||||
|
|
||||||
# Validation of parameters
|
# Validation of parameters
|
||||||
if (($Method -in ("POST", "PUT", "PATCH")) -and (!($Body))) {
|
if (($Method -in ("POST", "PUT", "PATCH")) -and (!($Body))) {
|
||||||
$message = "The following parameters are required when using the ${Method} parameter: Body."
|
$message = "The following parameters are required when using the ${Method} parameter: Body."
|
||||||
|
|
@ -33,35 +56,36 @@
|
||||||
Throw $exception
|
Throw $exception
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#Build request uri
|
||||||
|
$apiUri = "$Url$Api"
|
||||||
#To support images "image" property have be handled before this
|
#To support images "image" property have be handled before this
|
||||||
|
|
||||||
$_headers = @{
|
$_headers = @{
|
||||||
"Authorization" = "Bearer $($token)"
|
"Authorization" = "Bearer $($Token)"
|
||||||
'Content-Type' = 'application/json; charset=utf-8'
|
'Content-Type' = 'application/json; charset=utf-8'
|
||||||
"Accept" = "application/json"
|
"Accept" = "application/json"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Process {
|
Process {
|
||||||
if ($GetParameters -and ($URi -notlike "*\?*"))
|
# This can be done using $Body, maybe some day - PetriAsi
|
||||||
{
|
if ($GetParameters -and ($apiUri -notlike "*\?*")){
|
||||||
Write-Debug "Using `$GetParameters: $($GetParameters | Out-String)"
|
Write-Debug "Using `$GetParameters: $($GetParameters | Out-String)"
|
||||||
[string]$URI += (ConvertTo-GetParameter $GetParameters)
|
[string]$apiUri = $apiUri + (ConvertTo-GetParameter $GetParameters)
|
||||||
# Prevent recursive appends
|
# Prevent recursive appends
|
||||||
$GetParameters = $null
|
$GetParameters = $null
|
||||||
}
|
}
|
||||||
|
|
||||||
# set mandatory parameters
|
# set mandatory parameters
|
||||||
$splatParameters = @{
|
$splatParameters = @{
|
||||||
Uri = $URi
|
Uri = $apiUri
|
||||||
Method = $Method
|
Method = $Method
|
||||||
Headers = $_headers
|
Headers = $_headers
|
||||||
UseBasicParsing = $true
|
UseBasicParsing = $true
|
||||||
ErrorAction = 'SilentlyContinue'
|
ErrorAction = 'SilentlyContinue'
|
||||||
}
|
}
|
||||||
|
|
||||||
# Place holder for intended image manipulation
|
# Send image requests as multipart/form-data if supported
|
||||||
# if and when snipe it API gets support for images
|
|
||||||
if($null -ne $body -and $Body.Keys -contains 'image' ){
|
if($null -ne $body -and $Body.Keys -contains 'image' ){
|
||||||
if($PSVersionTable.PSVersion -ge '7.0'){
|
if($PSVersionTable.PSVersion -ge '7.0'){
|
||||||
$Body['image'] = get-item $body['image']
|
$Body['image'] = get-item $body['image']
|
||||||
|
|
@ -79,7 +103,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($Body -and $splatParameters.Keys -notcontains 'Form') {
|
if ($Body -and $splatParameters.Keys -notcontains 'Form') {
|
||||||
$splatParameters["Body"] = $Body | Convertto-Json
|
$splatParameters["Body"] = [System.Text.Encoding]::UTF8.GetBytes(($Body | Convertto-Json))
|
||||||
}
|
}
|
||||||
|
|
||||||
$script:PSDefaultParameterValues = $global:PSDefaultParameterValues
|
$script:PSDefaultParameterValues = $global:PSDefaultParameterValues
|
||||||
|
|
@ -105,18 +129,16 @@
|
||||||
if ($webResponse) {
|
if ($webResponse) {
|
||||||
Write-Verbose $webResponse
|
Write-Verbose $webResponse
|
||||||
|
|
||||||
# API returned a Content: lets work wit it
|
# API returned a Content: lets work with it
|
||||||
try{
|
try{
|
||||||
|
|
||||||
if ($webResponse.status -eq "error") {
|
if ($webResponse.status -eq "error") {
|
||||||
Write-Verbose "[$($MyInvocation.MyCommand.Name)] An error response was received from; resolving"
|
Write-Verbose "[$($MyInvocation.MyCommand.Name)] An error response was received ... resolving"
|
||||||
# This could be handled nicely in an function such as:
|
# This could be handled nicely in an function such as:
|
||||||
# ResolveError $response -WriteError
|
# ResolveError $response -WriteError
|
||||||
Write-Error $($webResponse.messages | Out-String)
|
Write-Error $($webResponse.messages | Out-String)
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
#update operations return payload
|
#update operations return payload
|
||||||
if ($webResponse.payload){
|
if ($webResponse.payload) {
|
||||||
$result = $webResponse.payload
|
$result = $webResponse.payload
|
||||||
}
|
}
|
||||||
#Search operations return rows
|
#Search operations return rows
|
||||||
|
|
@ -124,7 +146,7 @@
|
||||||
$result = $webResponse.rows
|
$result = $webResponse.rows
|
||||||
}
|
}
|
||||||
#Remove operations returns status and message
|
#Remove operations returns status and message
|
||||||
elseif ($webResponse.status -eq 'success'){
|
elseif ($webResponse.status -eq 'success') {
|
||||||
$result = $webResponse.payload
|
$result = $webResponse.payload
|
||||||
}
|
}
|
||||||
#Search and query result with no results
|
#Search and query result with no results
|
||||||
|
|
@ -140,9 +162,6 @@
|
||||||
Write-Verbose "Messages: $($webResponse.messages)"
|
Write-Verbose "Messages: $($webResponse.messages)"
|
||||||
|
|
||||||
$result
|
$result
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
|
|
@ -151,7 +170,7 @@
|
||||||
|
|
||||||
}
|
}
|
||||||
elseif ($webResponse.StatusCode -eq "Unauthorized") {
|
elseif ($webResponse.StatusCode -eq "Unauthorized") {
|
||||||
Write-Error "[$($MyInvocation.MyCommand.Name)] You are not Authorized to access the resource, check your token is correct"
|
Write-Error "[$($MyInvocation.MyCommand.Name)] You are not Authorized to access the resource, check your apiKey is correct"
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
# No content, although statusCode < 400
|
# No content, although statusCode < 400
|
||||||
|
|
@ -169,3 +188,4 @@
|
||||||
Write-Verbose "[$($MyInvocation.MyCommand.Name)] Function ended"
|
Write-Verbose "[$($MyInvocation.MyCommand.Name)] Function ended"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
16
SnipeitPS/Private/Reset-SnipeitPSLegacyApi.ps1
Normal file
16
SnipeitPS/Private/Reset-SnipeitPSLegacyApi.ps1
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
function Reset-SnipeitPSLegacyApi {
|
||||||
|
[CmdletBinding(
|
||||||
|
SupportsShouldProcess = $true,
|
||||||
|
ConfirmImpact = "Low"
|
||||||
|
)]
|
||||||
|
param(
|
||||||
|
)
|
||||||
|
process {
|
||||||
|
Write-Verbose 'Reset-SnipeitPSLegacyApi'
|
||||||
|
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
||||||
|
$SnipeitPSSession.legacyUrl = $null
|
||||||
|
$SnipeitPSSession.legacyApiKey = $null
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
14
SnipeitPS/Private/Set-SnipeitPSLegacyApiKey.ps1
Normal file
14
SnipeitPS/Private/Set-SnipeitPSLegacyApiKey.ps1
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
function Set-SnipeitPSLegacyApiKey {
|
||||||
|
[CmdletBinding(
|
||||||
|
SupportsShouldProcess = $true,
|
||||||
|
ConfirmImpact = "Low"
|
||||||
|
)]
|
||||||
|
param(
|
||||||
|
[string]$apiKey
|
||||||
|
)
|
||||||
|
process {
|
||||||
|
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
||||||
|
$SnipeitPSSession.legacyApiKey = ConvertTo-SecureString -AsPlainText -String $apiKey
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
14
SnipeitPS/Private/Set-SnipeitPSLegacyUrl.ps1
Normal file
14
SnipeitPS/Private/Set-SnipeitPSLegacyUrl.ps1
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
function Set-SnipeitPSLegacyUrl {
|
||||||
|
[CmdletBinding(
|
||||||
|
SupportsShouldProcess = $true,
|
||||||
|
ConfirmImpact = "Low"
|
||||||
|
)]
|
||||||
|
param(
|
||||||
|
$url
|
||||||
|
)
|
||||||
|
process {
|
||||||
|
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
||||||
|
$SnipeitPSSession.legacyUrl = $url.TrimEnd('/')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
18
SnipeitPS/Private/Test-SnipeitPSConnection.ps1
Normal file
18
SnipeitPS/Private/Test-SnipeitPSConnection.ps1
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
function Test-SnipeitPSConnection {
|
||||||
|
#test api connection
|
||||||
|
$Parameters = @{
|
||||||
|
Api = '/api/v1/statuslabels'
|
||||||
|
Method = 'Get'
|
||||||
|
GetParameters = @{'limit'=1}
|
||||||
|
}
|
||||||
|
Write-Verbose "Testing connection to $($SnipeitPSSession.url)."
|
||||||
|
|
||||||
|
$contest = Invoke-SnipeitMethod @Parameters
|
||||||
|
|
||||||
|
if ( $contest) {
|
||||||
|
Write-Verbose "Connection to $($SnipeitPSSession.url) tested succesfully."
|
||||||
|
return $true
|
||||||
|
} else {
|
||||||
|
return $false
|
||||||
|
}
|
||||||
|
}
|
||||||
93
SnipeitPS/Public/Connect-SnipeitPS.ps1
Normal file
93
SnipeitPS/Public/Connect-SnipeitPS.ps1
Normal file
|
|
@ -0,0 +1,93 @@
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Sets authetication information
|
||||||
|
|
||||||
|
.DESCRIPTION
|
||||||
|
Sets apikey and url to connect Snipe-It system.
|
||||||
|
Based on Set-SnipeitInfo command, what is now just compatibility wrapper
|
||||||
|
and calls Connect-SnipeitPS
|
||||||
|
|
||||||
|
.PARAMETER url
|
||||||
|
URL of Snipeit system.
|
||||||
|
|
||||||
|
.PARAMETER apiKey
|
||||||
|
User's API Key for Snipeit.
|
||||||
|
|
||||||
|
.PARAMETER secureApiKey
|
||||||
|
Snipe it Api key as securestring
|
||||||
|
|
||||||
|
.PARAMETER siteCred
|
||||||
|
PSCredential where username shoul be snipe it url and password should be
|
||||||
|
snipe it apikey.
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
Connect-SnipeitPS -Url $url -apiKey $myapikey
|
||||||
|
Connect to Snipe it api.
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
Connect-SnipeitPS -Url $url -SecureApiKey $myapikey
|
||||||
|
Connects to Snipe it api with apikey stored to securestring
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
Connect-SnipeitPS -siteCred (Get-Credential -message "Use site url as username and apikey as password")
|
||||||
|
Connect to Snipe It with PSCredential object.
|
||||||
|
To use saved creadentials yu can use export-clixml and import-clixml commandlets.
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
Build credential with apikey value from secret vault (Microsoft.PowerShell.SecretManagement)
|
||||||
|
$siteurl = "https://mysnipeitsite.url"
|
||||||
|
$apikey = Get-SecretInfo -Name SnipeItApiKey
|
||||||
|
$siteCred = New-Object -Type PSCredential -Argumentlist $siteurl,$spikey
|
||||||
|
Connect-SnipeitPS -siteCred $siteCred
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#>
|
||||||
|
function Connect-SnipeitPS {
|
||||||
|
[CmdletBinding(
|
||||||
|
DefaultParameterSetName = 'Connect with url and apikey'
|
||||||
|
)]
|
||||||
|
[System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseShouldProcessForStateChangingFunctions', '')]
|
||||||
|
|
||||||
|
param (
|
||||||
|
[Parameter(ParameterSetName='Connect with url and apikey',Mandatory=$true)]
|
||||||
|
[Parameter(ParameterSetName='Connect with url and secure apikey',Mandatory=$true)]
|
||||||
|
[Uri]$url,
|
||||||
|
|
||||||
|
[Parameter(ParameterSetName='Connect with url and apikey',Mandatory=$true)]
|
||||||
|
[String]$apiKey,
|
||||||
|
|
||||||
|
[Parameter(ParameterSetName='Connect with url and secure apikey',Mandatory=$true)]
|
||||||
|
[SecureString]$secureApiKey,
|
||||||
|
|
||||||
|
[Parameter(ParameterSetName='Connect with credential',Mandatory=$true)]
|
||||||
|
[PSCredential]$siteCred
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
PROCESS {
|
||||||
|
switch ($PsCmdlet.ParameterSetName) {
|
||||||
|
'Connect with url and apikey' {
|
||||||
|
$SnipeitPSSession.url = $url.AbsoluteUri.TrimEnd('/')
|
||||||
|
$SnipeitPSSession.apiKey = ConvertTo-SecureString -AsPlainText -String $apiKey
|
||||||
|
}
|
||||||
|
|
||||||
|
'Connect with url and secure apikey' {
|
||||||
|
$SnipeitPSSession.url = $url.AbsoluteUri.TrimEnd('/')
|
||||||
|
$SnipeitPSSession.apiKey = $secureApiKey
|
||||||
|
}
|
||||||
|
|
||||||
|
'Connect with credential' {
|
||||||
|
$SnipeitPSSession.url = ($siteCred.GetNetworkCredential().UserName).TrimEnd('/')
|
||||||
|
$SnipeitPSSession.apiKey = $siteCred.GetNetworkCredential().SecurePassword
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Debug "Site-url $($SnipeitPSSession.url)"
|
||||||
|
Write-Debug "Site apikey: $($SnipeitPSSession.apiKey)"
|
||||||
|
|
||||||
|
if (-not (Test-SnipeitPSConnection)) {
|
||||||
|
throw "Cannot verify connection to snipe it. For the start try to check url and provided apikey or credential parameters"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -21,10 +21,10 @@ Result offset to use
|
||||||
A return all results, works with -offset and other parameters
|
A return all results, works with -offset and other parameters
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Get-SnipeitAccessory -search Keyboard
|
Get-SnipeitAccessory -search Keyboard
|
||||||
|
|
@ -79,31 +79,43 @@ function Get-SnipeitAccessory() {
|
||||||
[parameter(ParameterSetName='Accessories checked out to user id')]
|
[parameter(ParameterSetName='Accessories checked out to user id')]
|
||||||
[switch]$all = $false,
|
[switch]$all = $false,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
begin {
|
||||||
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
||||||
|
|
||||||
switch($PsCmdlet.ParameterSetName) {
|
switch($PsCmdlet.ParameterSetName) {
|
||||||
'Search' {$apiurl = "$url/api/v1/accessories"}
|
'Search' {$api = "/api/v1/accessories"}
|
||||||
'Get by ID' {$apiurl= "$url/api/v1/accessories/$id"}
|
'Get by ID' {$api= "/api/v1/accessories/$id"}
|
||||||
'Accessories checked out to user id' {$apiurl = "$url/api/v1/users/$user_id/accessories"}
|
'Accessories checked out to user id' {$api = "/api/v1/users/$user_id/accessories"}
|
||||||
}
|
}
|
||||||
|
|
||||||
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
|
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
|
||||||
|
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = $apiurl
|
Api = $api
|
||||||
Method = 'Get'
|
Method = 'Get'
|
||||||
GetParameters = $SearchParameter
|
GetParameters = $SearchParameter
|
||||||
Token = $apiKey
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
process {
|
||||||
if ($all) {
|
if ($all) {
|
||||||
$offstart = $(if($offset){$offset} Else {0})
|
$offstart = $(if ($offset) {$offset} Else {0})
|
||||||
$callargs = $SearchParameter
|
$callargs = $SearchParameter
|
||||||
$callargs.Remove('all')
|
$callargs.Remove('all')
|
||||||
|
|
||||||
|
|
@ -121,6 +133,14 @@ function Get-SnipeitAccessory() {
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
$result
|
$result
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,16 +8,15 @@
|
||||||
Unique ID For accessory to list
|
Unique ID For accessory to list
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
User's API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Get-SnipeitAccessoryOwner -id 1
|
Get-SnipeitAccessoryOwner -id 1
|
||||||
#>
|
#>
|
||||||
function Get-SnipeitAccessoryOwner()
|
function Get-SnipeitAccessoryOwner() {
|
||||||
{
|
|
||||||
[CmdletBinding(
|
[CmdletBinding(
|
||||||
SupportsShouldProcess = $true,
|
SupportsShouldProcess = $true,
|
||||||
ConfirmImpact = "Medium"
|
ConfirmImpact = "Medium"
|
||||||
|
|
@ -27,23 +26,39 @@ function Get-SnipeitAccessoryOwner()
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $true)]
|
||||||
[int]$id,
|
[int]$id,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
begin {
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/accessories/$id/checkedout"
|
Api = "/api/v1/accessories/$id/checkedout"
|
||||||
Method = 'GET'
|
Method = 'GET'
|
||||||
Token = $apiKey
|
|
||||||
}
|
}
|
||||||
|
|
||||||
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
{
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
}
|
||||||
|
process {
|
||||||
|
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
}
|
}
|
||||||
|
$result
|
||||||
|
}
|
||||||
|
|
||||||
return $result
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,10 +30,10 @@ Result offset to use
|
||||||
A return all results, works with -offset and other parameters
|
A return all results, works with -offset and other parameters
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Get-SnipeitAccessory -search Keyboard
|
Get-SnipeitAccessory -search Keyboard
|
||||||
|
|
@ -71,19 +71,19 @@ function Get-SnipeitActivity() {
|
||||||
|
|
||||||
[switch]$all = $false,
|
[switch]$all = $false,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
begin {
|
||||||
if(($target_type -and -not $target_id) -or
|
if (($target_type -and -not $target_id) -or
|
||||||
($target_id -and -not $target_type)) {
|
($target_id -and -not $target_type)) {
|
||||||
throw "Please specify both target_type and target_id"
|
throw "Please specify both target_type and target_id"
|
||||||
}
|
}
|
||||||
|
|
||||||
if(($item_type -and -not $item_id) -or
|
if (($item_type -and -not $item_id) -or
|
||||||
($item_id -and -not $item_type)) {
|
($item_id -and -not $item_type)) {
|
||||||
throw "Please specify both item_type and item_id"
|
throw "Please specify both item_type and item_id"
|
||||||
}
|
}
|
||||||
|
|
@ -92,14 +92,25 @@ function Get-SnipeitActivity() {
|
||||||
|
|
||||||
|
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/reports/activity"
|
Api = "/api/v1/reports/activity"
|
||||||
Method = 'Get'
|
Method = 'Get'
|
||||||
GetParameters = $SearchParameter
|
GetParameters = $SearchParameter
|
||||||
Token = $apiKey
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
process {
|
||||||
if ($all) {
|
if ($all) {
|
||||||
$offstart = $(if($offset){$offset} Else {0})
|
$offstart = $(if ($offset) {$offset} Else {0})
|
||||||
$callargs = $SearchParameter
|
$callargs = $SearchParameter
|
||||||
$callargs.Remove('all')
|
$callargs.Remove('all')
|
||||||
|
|
||||||
|
|
@ -117,6 +128,14 @@ function Get-SnipeitActivity() {
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
$result
|
$result
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -60,13 +60,13 @@ Offset to use
|
||||||
A return all results, works with -offset and other parameters
|
A return all results, works with -offset and other parameters
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Get-SnipeitAsset -all -url "https://assets.example.com"-token "token..."
|
Get-SnipeitAsset -all
|
||||||
Returens all assets
|
Returens all assets
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
|
|
@ -199,37 +199,49 @@ function Get-SnipeitAsset() {
|
||||||
[parameter(ParameterSetName='Assets with component id')]
|
[parameter(ParameterSetName='Assets with component id')]
|
||||||
[switch]$all = $false,
|
[switch]$all = $false,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
|
||||||
|
begin {
|
||||||
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
||||||
|
|
||||||
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
|
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
|
||||||
|
|
||||||
switch ($PsCmdlet.ParameterSetName) {
|
switch ($PsCmdlet.ParameterSetName) {
|
||||||
'Search' { $apiurl = "$url/api/v1/hardware" }
|
'Search' { $api = "/api/v1/hardware" }
|
||||||
'Get with id' {$apiurl= "$url/api/v1/hardware/$id"}
|
'Get with id' {$api= "/api/v1/hardware/$id"}
|
||||||
'Get with asset tag' {$apiurl= "$url/api/v1/hardware/bytag/$asset_tag"}
|
'Get with asset tag' {$api= "/api/v1/hardware/bytag/$asset_tag"}
|
||||||
'Get with serial' { $apiurl= "$url/api/v1/hardware/byserial/$serial"}
|
'Get with serial' { $api= "/api/v1/hardware/byserial/$serial"}
|
||||||
'Assets due auditing soon' {$apiurl = "$url/api/v1/hardware/audit/due"}
|
'Assets due auditing soon' {$api = "/api/v1/hardware/audit/due"}
|
||||||
'Assets overdue for auditing' {$apiurl = "$url/api/v1/hardware/audit/overdue"}
|
'Assets overdue for auditing' {$api = "/api/v1/hardware/audit/overdue"}
|
||||||
'Assets checked out to user id'{$apiurl = "$url/api/v1/users/$user_id/assets"}
|
'Assets checked out to user id'{$api = "/api/v1/users/$user_id/assets"}
|
||||||
'Assets with component id' {$apiurl = "$url/api/v1/components/$component_id/assets"}
|
'Assets with component id' {$api = "/api/v1/components/$component_id/assets"}
|
||||||
}
|
}
|
||||||
|
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = $apiurl
|
Api = $api
|
||||||
Method = 'Get'
|
Method = 'Get'
|
||||||
GetParameters = $SearchParameter
|
GetParameters = $SearchParameter
|
||||||
Token = $apiKey
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
process {
|
||||||
if ($all) {
|
if ($all) {
|
||||||
$offstart = $(if ($offset){$offset} Else {0})
|
$offstart = $(if ($offset) {$offset} Else {0})
|
||||||
$callargs = $SearchParameter
|
$callargs = $SearchParameter
|
||||||
Write-Verbose "Callargs: $($callargs | convertto-json)"
|
Write-Verbose "Callargs: $($callargs | convertto-json)"
|
||||||
$callargs.Remove('all')
|
$callargs.Remove('all')
|
||||||
|
|
@ -248,7 +260,14 @@ function Get-SnipeitAsset() {
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
$result
|
$result
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,19 +24,18 @@ Offset to use
|
||||||
A return all results, works with -offset and other parameters
|
A return all results, works with -offset and other parameters
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Get-SnipeitAssetMaintenances -url "https://assets.example.com" -token "token..."
|
Get-SnipeitAssetMaintenances
|
||||||
|
.EXAMPLE
|
||||||
|
Get-SnipeitAssetMaintenances -search "myMachine"
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Get-SnipeitAssetMaintenances -search "myMachine" -url "https://assets.example.com" -token "token..."
|
Get-SnipeitAssetMaintenances -search "myMachine"
|
||||||
|
|
||||||
.EXAMPLE
|
|
||||||
Get-SnipeitAssetMaintenances -search "myMachine" -url "https://assets.example.com" -token "token..."
|
|
||||||
#>
|
#>
|
||||||
function Get-SnipeitAssetMaintenance() {
|
function Get-SnipeitAssetMaintenance() {
|
||||||
Param(
|
Param(
|
||||||
|
|
@ -55,26 +54,37 @@ function Get-SnipeitAssetMaintenance() {
|
||||||
|
|
||||||
[int]$offset,
|
[int]$offset,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
begin {
|
||||||
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
||||||
|
|
||||||
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
|
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
|
||||||
|
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/maintenances"
|
Api = "/api/v1/maintenances"
|
||||||
Method = 'Get'
|
Method = 'Get'
|
||||||
GetParameters = $SearchParameter
|
GetParameters = $SearchParameter
|
||||||
Token = $apiKey
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
process {
|
||||||
if ($all) {
|
if ($all) {
|
||||||
$offstart = $(if($offset){$offset} Else {0})
|
$offstart = $(if ($offset) {$offset} Else {0})
|
||||||
$callargs = $SearchParameter
|
$callargs = $SearchParameter
|
||||||
$callargs.Remove('all')
|
$callargs.Remove('all')
|
||||||
|
|
||||||
|
|
@ -92,6 +102,14 @@ function Get-SnipeitAssetMaintenance() {
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
$result
|
$result
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,10 +18,10 @@ Offset to use
|
||||||
A return all results, works with -offset and other parameters
|
A return all results, works with -offset and other parameters
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
Url of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. Url of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Get-SnipeitCategory -id 1
|
Get-SnipeitCategory -id 1
|
||||||
|
|
@ -31,8 +31,7 @@ Get-SnipeitCategory -search "Laptop"
|
||||||
|
|
||||||
#>
|
#>
|
||||||
|
|
||||||
function Get-SnipeitCategory()
|
function Get-SnipeitCategory() {
|
||||||
{
|
|
||||||
[CmdletBinding(DefaultParameterSetName = 'Search')]
|
[CmdletBinding(DefaultParameterSetName = 'Search')]
|
||||||
Param(
|
Param(
|
||||||
[parameter(ParameterSetName='Search')]
|
[parameter(ParameterSetName='Search')]
|
||||||
|
|
@ -54,35 +53,47 @@ function Get-SnipeitCategory()
|
||||||
[parameter(ParameterSetName='Search')]
|
[parameter(ParameterSetName='Search')]
|
||||||
[switch]$all = $false,
|
[switch]$all = $false,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
|
||||||
|
begin {
|
||||||
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
||||||
|
|
||||||
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
|
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
|
||||||
|
|
||||||
$apiurl = "$url/api/v1/categories"
|
$api = "/api/v1/categories"
|
||||||
|
|
||||||
if ($search -and $id ) {
|
if ($search -and $id ) {
|
||||||
Throw "[$($MyInvocation.MyCommand.Name)] Please specify only -search or -id parameter , not both "
|
Throw "[$($MyInvocation.MyCommand.Name)] Please specify only -search or -id parameter , not both "
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($id) {
|
if ($id) {
|
||||||
$apiurl= "$url/api/v1/categories/$id"
|
$api= "/api/v1/categories/$id"
|
||||||
}
|
}
|
||||||
|
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = $apiurl
|
Api = $api
|
||||||
Method = 'Get'
|
Method = 'Get'
|
||||||
Token = $apiKey
|
|
||||||
GetParameters = $SearchParameter
|
GetParameters = $SearchParameter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
}
|
||||||
|
process {
|
||||||
if ($all) {
|
if ($all) {
|
||||||
$offstart = $(if($offset){$offset} Else {0})
|
$offstart = $(if ($offset) {$offset} Else {0})
|
||||||
$callargs = $SearchParameter
|
$callargs = $SearchParameter
|
||||||
$callargs.Remove('all')
|
$callargs.Remove('all')
|
||||||
|
|
||||||
|
|
@ -100,4 +111,12 @@ function Get-SnipeitCategory()
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
$result
|
$result
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,10 +17,10 @@ Offset to use
|
||||||
.PARAMETER all
|
.PARAMETER all
|
||||||
A return all results, works with -offset and other parameters
|
A return all results, works with -offset and other parameters
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Get-SnipeitCompany
|
Get-SnipeitCompany
|
||||||
|
|
@ -32,8 +32,7 @@ Gets specific company
|
||||||
|
|
||||||
#>
|
#>
|
||||||
|
|
||||||
function Get-SnipeitCompany()
|
function Get-SnipeitCompany() {
|
||||||
{
|
|
||||||
[CmdletBinding(DefaultParameterSetName = 'Search')]
|
[CmdletBinding(DefaultParameterSetName = 'Search')]
|
||||||
Param(
|
Param(
|
||||||
[parameter(ParameterSetName='Search')]
|
[parameter(ParameterSetName='Search')]
|
||||||
|
|
@ -55,36 +54,47 @@ function Get-SnipeitCompany()
|
||||||
[parameter(ParameterSetName='Search')]
|
[parameter(ParameterSetName='Search')]
|
||||||
[switch]$all = $false,
|
[switch]$all = $false,
|
||||||
|
|
||||||
[parameter(mandatory=$true)]
|
[parameter(mandatory=$false)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
[parameter(mandatory=$true)]
|
[parameter(mandatory=$false)]
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
|
||||||
|
begin {
|
||||||
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
||||||
|
|
||||||
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
|
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
|
||||||
|
|
||||||
$apiurl = "$url/api/v1/companies"
|
$api = "/api/v1/companies"
|
||||||
|
|
||||||
if ($search -and $id ) {
|
if ($search -and $id ) {
|
||||||
Throw "[$($MyInvocation.MyCommand.Name)] Please specify only -search or -id parameter , not both "
|
Throw "[$($MyInvocation.MyCommand.Name)] Please specify only -search or -id parameter , not both "
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($id) {
|
if ($id) {
|
||||||
$apiurl= "$url/api/v1/companies/$id"
|
$api= "/api/v1/companies/$id"
|
||||||
}
|
}
|
||||||
|
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = $apiurl
|
Api = $api
|
||||||
Method = 'Get'
|
Method = 'Get'
|
||||||
Token = $apiKey
|
|
||||||
GetParameters = $SearchParameter
|
GetParameters = $SearchParameter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
}
|
||||||
|
process {
|
||||||
if ($all) {
|
if ($all) {
|
||||||
$offstart = $(if($offset){$offset} Else {0})
|
$offstart = $(if ($offset) {$offset} Else {0})
|
||||||
$callargs = $SearchParameter
|
$callargs = $SearchParameter
|
||||||
$callargs.Remove('all')
|
$callargs.Remove('all')
|
||||||
|
|
||||||
|
|
@ -102,4 +112,12 @@ function Get-SnipeitCompany()
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
$result
|
$result
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,10 +18,10 @@ Offset to use
|
||||||
A return all results, works with -offset and other parameters
|
A return all results, works with -offset and other parameters
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system,can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Get-SnipeitComponent
|
Get-SnipeitComponent
|
||||||
|
|
@ -71,36 +71,48 @@ function Get-SnipeitComponent() {
|
||||||
[parameter(ParameterSetName='Search')]
|
[parameter(ParameterSetName='Search')]
|
||||||
[switch]$all = $false,
|
[switch]$all = $false,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
|
||||||
|
begin {
|
||||||
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
||||||
|
|
||||||
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
|
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
|
||||||
|
|
||||||
$apiurl = "$url/api/v1/components"
|
$api = "/api/v1/components"
|
||||||
|
|
||||||
if ($search -and $id ) {
|
if ($search -and $id ) {
|
||||||
Throw "[$($MyInvocation.MyCommand.Name)] Please specify only -search or -id parameter , not both "
|
Throw "[$($MyInvocation.MyCommand.Name)] Please specify only -search or -id parameter , not both "
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($id) {
|
if ($id) {
|
||||||
$apiurl= "$url/api/v1/components/$id"
|
$api= "/api/v1/components/$id"
|
||||||
}
|
}
|
||||||
|
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = $apiurl
|
Api = $api
|
||||||
Method = 'Get'
|
Method = 'Get'
|
||||||
Token = $apiKey
|
|
||||||
GetParameters = $SearchParameter
|
GetParameters = $SearchParameter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
process {
|
||||||
if ($all) {
|
if ($all) {
|
||||||
$offstart = $(if($offset){$offset} Else {0})
|
$offstart = $(if ($offset) {$offset} Else {0})
|
||||||
$callargs = $SearchParameter
|
$callargs = $SearchParameter
|
||||||
$callargs.Remove('all')
|
$callargs.Remove('all')
|
||||||
|
|
||||||
|
|
@ -118,4 +130,12 @@ function Get-SnipeitComponent() {
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
$result
|
$result
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,10 +36,10 @@ Offset to use
|
||||||
A return all results
|
A return all results
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system,can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Get-SnipeitConsumable -all
|
Get-SnipeitConsumable -all
|
||||||
|
|
@ -96,29 +96,38 @@ function Get-SnipeitConsumable() {
|
||||||
[parameter(ParameterSetName='Search')]
|
[parameter(ParameterSetName='Search')]
|
||||||
[switch]$all = $false,
|
[switch]$all = $false,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
begin {
|
begin {
|
||||||
|
|
||||||
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
|
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
process {
|
process {
|
||||||
switch ($PSCmdlet.ParameterSetName) {
|
switch ($PSCmdlet.ParameterSetName) {
|
||||||
'Search' {
|
'Search' {
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/consumables"
|
Api = "/api/v1/consumables"
|
||||||
Method = 'Get'
|
Method = 'Get'
|
||||||
Token = $apiKey
|
|
||||||
GetParameters = $SearchParameter
|
GetParameters = $SearchParameter
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($all) {
|
if ($all) {
|
||||||
$offstart = $(if($offset){$offset} Else {0})
|
$offstart = $(if ($offset) {$offset} Else {0})
|
||||||
$callargs = $SearchParameter
|
$callargs = $SearchParameter
|
||||||
$callargs.Remove('all')
|
$callargs.Remove('all')
|
||||||
|
|
||||||
|
|
@ -141,16 +150,23 @@ function Get-SnipeitConsumable() {
|
||||||
'Get with ID' {
|
'Get with ID' {
|
||||||
foreach($consumable_id in $id) {
|
foreach($consumable_id in $id) {
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/consumables/$consumable_id"
|
Api = "$url/api/v1/consumables/$consumable_id"
|
||||||
Method = 'Get'
|
Method = 'Get'
|
||||||
Token = $apiKey
|
|
||||||
GetParameters = $SearchParameter
|
GetParameters = $SearchParameter
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
$result
|
$result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,44 +6,67 @@
|
||||||
A id of specific field
|
A id of specific field
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Get-SnipeitCustomField -url "https://assets.example.com" -token "token..."
|
Get-SnipeitCustomField
|
||||||
|
Get all custom fields
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
Get-SnipeitCustomField -id 1
|
||||||
|
Get custom field with ID 1
|
||||||
|
|
||||||
|
|
||||||
#>
|
#>
|
||||||
|
|
||||||
function Get-SnipeitCustomField()
|
function Get-SnipeitCustomField() {
|
||||||
{
|
|
||||||
Param(
|
Param(
|
||||||
[int]$id,
|
[int]$id,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
|
||||||
|
begin {
|
||||||
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
||||||
|
|
||||||
if ($id) {
|
if ($id) {
|
||||||
$apiurl= "$url/api/v1/fields/$id"
|
$api= "/api/v1/fields/$id"
|
||||||
} else {
|
} else {
|
||||||
$apiurl = "$url/api/v1/fields"
|
$api = "/api/v1/fields"
|
||||||
}
|
}
|
||||||
|
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = $apiurl
|
Api = $api
|
||||||
Method = 'Get'
|
Method = 'Get'
|
||||||
Token = $apiKey
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
process {
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
|
|
||||||
$result
|
$result
|
||||||
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,13 +18,13 @@ Offset to use
|
||||||
A return all results, works with -offset and other parameters
|
A return all results, works with -offset and other parameters
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Get-SnipeitDepartment -url "https://assets.example.com" -token "token..."
|
Get-SnipeitDepartment
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Get-SnipeitDepartment -search Department1
|
Get-SnipeitDepartment -search Department1
|
||||||
|
|
@ -34,8 +34,7 @@ Get-SnipeitDepartment -id 1
|
||||||
|
|
||||||
#>
|
#>
|
||||||
|
|
||||||
function Get-SnipeitDepartment()
|
function Get-SnipeitDepartment() {
|
||||||
{
|
|
||||||
[CmdletBinding(DefaultParameterSetName = 'Search')]
|
[CmdletBinding(DefaultParameterSetName = 'Search')]
|
||||||
Param(
|
Param(
|
||||||
[parameter(ParameterSetName='Search')]
|
[parameter(ParameterSetName='Search')]
|
||||||
|
|
@ -61,36 +60,47 @@ function Get-SnipeitDepartment()
|
||||||
[ValidateSet('id', 'name', 'image', 'users_count', 'created_at')]
|
[ValidateSet('id', 'name', 'image', 'users_count', 'created_at')]
|
||||||
[string]$sort = "created_at",
|
[string]$sort = "created_at",
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
begin {
|
||||||
|
|
||||||
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
||||||
|
|
||||||
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
|
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
|
||||||
|
|
||||||
$apiurl = "$url/api/v1/departments"
|
$api = "/api/v1/departments"
|
||||||
|
|
||||||
if ($search -and $id ) {
|
if ($search -and $id ) {
|
||||||
Throw "[$($MyInvocation.MyCommand.Name)] Please specify only -search or -id parameter , not both "
|
Throw "[$($MyInvocation.MyCommand.Name)] Please specify only -search or -id parameter , not both "
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($id) {
|
if ($id) {
|
||||||
$apiurl= "$url/api/v1/departments/$id"
|
$api= "/api/v1/departments/$id"
|
||||||
}
|
}
|
||||||
|
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = $apiurl
|
Api = $api
|
||||||
Method = 'Get'
|
Method = 'Get'
|
||||||
Token = $apiKey
|
|
||||||
GetParameters = $SearchParameter
|
GetParameters = $SearchParameter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
}
|
||||||
|
process {
|
||||||
if ($all) {
|
if ($all) {
|
||||||
$offstart = $(if($offset){$offset} Else {0})
|
$offstart = $(if ($offset) {$offset} Else {0})
|
||||||
$callargs = $SearchParameter
|
$callargs = $SearchParameter
|
||||||
$callargs.Remove('all')
|
$callargs.Remove('all')
|
||||||
|
|
||||||
|
|
@ -108,5 +118,13 @@ function Get-SnipeitDepartment()
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
$result
|
$result
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,16 +6,18 @@ Returns a fieldset or list of Snipe-it Fieldsets
|
||||||
A id of specific fieldset
|
A id of specific fieldset
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Get-SnipeitFieldset -url "https://assets.example.com" -token "token..."
|
Get-SnipeitFieldset
|
||||||
|
Get all fieldsets
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Get-SnipeitFieldset -url "https://assets.example.com" -token "token..." | Where-Object {$_.name -eq "Windows" }
|
Get-SnipeitFieldset | Where-Object {$_.name -eq "Windows" }
|
||||||
|
Gets fieldset by name
|
||||||
|
|
||||||
#>
|
#>
|
||||||
|
|
||||||
|
|
@ -23,28 +25,45 @@ function Get-SnipeitFieldset() {
|
||||||
Param(
|
Param(
|
||||||
[int]$id,
|
[int]$id,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
bagin {
|
||||||
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
||||||
|
|
||||||
if ($id) {
|
if ($id) {
|
||||||
$apiurl = "$url/api/v1/fieldsets/$id"
|
$api = "/api/v1/fieldsets/$id"
|
||||||
} else {
|
} else {
|
||||||
$apiurl = "$url/api/v1/fieldsets"
|
$api = "/api/v1/fieldsets"
|
||||||
}
|
}
|
||||||
|
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = $apiurl
|
Api = $api
|
||||||
Method = 'Get'
|
Method = 'Get'
|
||||||
Token = $apiKey
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
}
|
||||||
|
process {
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
|
|
||||||
$result
|
$result
|
||||||
|
}
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,10 +19,10 @@ A return all results, works with -offset and other parameters
|
||||||
|
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Get-SnipeitLicense -search SomeLicense
|
Get-SnipeitLicense -search SomeLicense
|
||||||
|
|
@ -98,33 +98,44 @@ function Get-SnipeitLicense() {
|
||||||
[parameter(ParameterSetName='Search')]
|
[parameter(ParameterSetName='Search')]
|
||||||
[switch]$all = $false,
|
[switch]$all = $false,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
bagin {
|
||||||
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
||||||
|
|
||||||
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
|
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
|
||||||
|
|
||||||
switch($PsCmdlet.ParameterSetName) {
|
switch($PsCmdlet.ParameterSetName) {
|
||||||
'Search' {$apiurl = "$url/api/v1/licenses"}
|
'Search' {$api = "/api/v1/licenses"}
|
||||||
'Get with ID' {$apiurl= "$url/api/v1/licenses/$id"}
|
'Get with ID' {$api= "/api/v1/licenses/$id"}
|
||||||
'Get licenses checked out to user ID' {$apiurl= "$url/api/v1/users/$user_id/licenses"}
|
'Get licenses checked out to user ID' {$api= "/api/v1/users/$user_id/licenses"}
|
||||||
'Get licenses checked out to asset ID' {$apiurl= "$url/api/v1/hardware/$asset_id/licenses"}
|
'Get licenses checked out to asset ID' {$api= "/api/v1/hardware/$asset_id/licenses"}
|
||||||
}
|
}
|
||||||
|
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = $apiurl
|
Api = $api
|
||||||
Method = 'Get'
|
Method = 'Get'
|
||||||
Token = $apiKey
|
|
||||||
GetParameters = $SearchParameter
|
GetParameters = $SearchParameter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
process {
|
||||||
if ($all) {
|
if ($all) {
|
||||||
$offstart = $(if($offset){$offset} Else {0})
|
$offstart = $(if ($offset) {$offset} Else {0})
|
||||||
$callargs = $SearchParameter
|
$callargs = $SearchParameter
|
||||||
$callargs.Remove('all')
|
$callargs.Remove('all')
|
||||||
|
|
||||||
|
|
@ -142,5 +153,13 @@ function Get-SnipeitLicense() {
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
$result
|
$result
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,10 +22,10 @@ A return all results, works with -offset and other parameters
|
||||||
|
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Get-SnipeitLicenseSeat -id 1
|
Get-SnipeitLicenseSeat -id 1
|
||||||
|
|
@ -47,33 +47,44 @@ function Get-SnipeitLicenseSeat() {
|
||||||
|
|
||||||
[switch]$all = $false,
|
[switch]$all = $false,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
begin {
|
||||||
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
||||||
|
|
||||||
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
|
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
|
||||||
|
|
||||||
$apiurl = "$url/api/v1/licenses/$id/seats"
|
$api = "/api/v1/licenses/$id/seats"
|
||||||
|
|
||||||
|
|
||||||
if ($seat_id) {
|
if ($seat_id) {
|
||||||
$apiurl= "$url/api/v1/licenses/$id/seats/$seat_id"
|
$api= "/api/v1/licenses/$id/seats/$seat_id"
|
||||||
}
|
}
|
||||||
|
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = $apiurl
|
Api = $api
|
||||||
Method = 'Get'
|
Method = 'Get'
|
||||||
Token = $apiKey
|
|
||||||
GetParameters = $SearchParameter
|
GetParameters = $SearchParameter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
process {
|
||||||
if ($all) {
|
if ($all) {
|
||||||
$offstart = $(if($offset){$offset} Else {0})
|
$offstart = $(if ($offset) {$offset} Else {0})
|
||||||
$callargs = $SearchParameter
|
$callargs = $SearchParameter
|
||||||
$callargs.Remove('all')
|
$callargs.Remove('all')
|
||||||
|
|
||||||
|
|
@ -91,5 +102,13 @@ function Get-SnipeitLicenseSeat() {
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
$result
|
$result
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,10 +18,10 @@ Offset to use
|
||||||
A return all results, works with -offset and other parameters
|
A return all results, works with -offset and other parameters
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfoeItInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Get-SnipeitLocation -search Location1
|
Get-SnipeitLocation -search Location1
|
||||||
|
|
@ -31,8 +31,7 @@ Get-SnipeitLocation -id 3
|
||||||
|
|
||||||
#>
|
#>
|
||||||
|
|
||||||
function Get-SnipeitLocation()
|
function Get-SnipeitLocation() {
|
||||||
{
|
|
||||||
[CmdletBinding(DefaultParameterSetName = 'Search')]
|
[CmdletBinding(DefaultParameterSetName = 'Search')]
|
||||||
Param(
|
Param(
|
||||||
[parameter(ParameterSetName='Search')]
|
[parameter(ParameterSetName='Search')]
|
||||||
|
|
@ -54,36 +53,47 @@ function Get-SnipeitLocation()
|
||||||
[parameter(ParameterSetName='Search')]
|
[parameter(ParameterSetName='Search')]
|
||||||
[switch]$all = $false,
|
[switch]$all = $false,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
begin {
|
||||||
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
||||||
|
|
||||||
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
|
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
|
||||||
|
|
||||||
$apiurl = "$url/api/v1/locations"
|
$api = "/api/v1/locations"
|
||||||
|
|
||||||
if ($search -and $id ) {
|
if ($search -and $id ) {
|
||||||
Throw "[$($MyInvocation.MyCommand.Name)] Please specify only -search or -id parameter , not both "
|
Throw "[$($MyInvocation.MyCommand.Name)] Please specify only -search or -id parameter , not both "
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($id) {
|
if ($id) {
|
||||||
$apiurl= "$url/api/v1/locations/$id"
|
$api= "/api/v1/locations/$id"
|
||||||
}
|
}
|
||||||
|
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = $apiurl
|
Api = $api
|
||||||
Method = 'Get'
|
Method = 'Get'
|
||||||
Token = $apiKey
|
|
||||||
GetParameters = $SearchParameter
|
GetParameters = $SearchParameter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
process {
|
||||||
if ($all) {
|
if ($all) {
|
||||||
$offstart = $(if($offset){$offset} Else {0})
|
$offstart = $(if ($offset) {$offset} Else {0})
|
||||||
$callargs = $SearchParameter
|
$callargs = $SearchParameter
|
||||||
$callargs.Remove('all')
|
$callargs.Remove('all')
|
||||||
|
|
||||||
|
|
@ -101,5 +111,13 @@ function Get-SnipeitLocation()
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
$result
|
$result
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,10 +18,10 @@
|
||||||
A return all results, works with -offset and other parameters
|
A return all results, works with -offset and other parameters
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Get-SnipeitManufacturer -search HP
|
Get-SnipeitManufacturer -search HP
|
||||||
|
|
@ -32,8 +32,7 @@
|
||||||
Returns manufacturer with id 3
|
Returns manufacturer with id 3
|
||||||
|
|
||||||
#>
|
#>
|
||||||
function Get-SnipeitManufacturer()
|
function Get-SnipeitManufacturer() {
|
||||||
{
|
|
||||||
[CmdletBinding(DefaultParameterSetName = 'Search')]
|
[CmdletBinding(DefaultParameterSetName = 'Search')]
|
||||||
Param(
|
Param(
|
||||||
[parameter(ParameterSetName='Search')]
|
[parameter(ParameterSetName='Search')]
|
||||||
|
|
@ -55,36 +54,47 @@ function Get-SnipeitManufacturer()
|
||||||
[parameter(ParameterSetName='Search')]
|
[parameter(ParameterSetName='Search')]
|
||||||
[switch]$all = $false,
|
[switch]$all = $false,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
begin {
|
||||||
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
||||||
|
|
||||||
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
|
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
|
||||||
|
|
||||||
$apiurl = "$url/api/v1/manufacturers"
|
$api = "/api/v1/manufacturers"
|
||||||
|
|
||||||
if ($search -and $id ) {
|
if ($search -and $id ) {
|
||||||
Throw "[$($MyInvocation.MyCommand.Name)] Please specify only -search or -id parameter , not both "
|
Throw "[$($MyInvocation.MyCommand.Name)] Please specify only -search or -id parameter , not both "
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($id) {
|
if ($id) {
|
||||||
$apiurl= "$url/api/v1/manufacturers/$id"
|
$api= "/api/v1/manufacturers/$id"
|
||||||
}
|
}
|
||||||
|
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = $apiurl
|
Api = $api
|
||||||
Method = 'Get'
|
Method = 'Get'
|
||||||
Token = $apiKey
|
|
||||||
GetParameters = $SearchParameter
|
GetParameters = $SearchParameter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
process {
|
||||||
if ($all) {
|
if ($all) {
|
||||||
$offstart = $(if($offset){$offset} Else {0})
|
$offstart = $(if ($offset) {$offset} Else {0})
|
||||||
$callargs = $SearchParameter
|
$callargs = $SearchParameter
|
||||||
$callargs.Remove('all')
|
$callargs.Remove('all')
|
||||||
|
|
||||||
|
|
@ -102,4 +112,12 @@ function Get-SnipeitManufacturer()
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
$result
|
$result
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,10 +18,10 @@ Offset to use
|
||||||
A return all results, works with -offset and other parameters
|
A return all results, works with -offset and other parameters
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Get-SnipeitModel -search "DL380"
|
Get-SnipeitModel -search "DL380"
|
||||||
|
|
@ -31,8 +31,7 @@ Get-SnipeitModel -id 1
|
||||||
|
|
||||||
#>
|
#>
|
||||||
|
|
||||||
function Get-SnipeitModel()
|
function Get-SnipeitModel() {
|
||||||
{
|
|
||||||
[CmdletBinding(DefaultParameterSetName = 'Search')]
|
[CmdletBinding(DefaultParameterSetName = 'Search')]
|
||||||
Param(
|
Param(
|
||||||
[parameter(ParameterSetName='Search')]
|
[parameter(ParameterSetName='Search')]
|
||||||
|
|
@ -54,36 +53,48 @@ function Get-SnipeitModel()
|
||||||
[parameter(ParameterSetName='Search')]
|
[parameter(ParameterSetName='Search')]
|
||||||
[switch]$all = $false,
|
[switch]$all = $false,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
|
||||||
|
begin {
|
||||||
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
||||||
|
|
||||||
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
|
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
|
||||||
|
|
||||||
$apiurl = "$url/api/v1/models"
|
$api = "/api/v1/models"
|
||||||
|
|
||||||
if ($search -and $id ) {
|
if ($search -and $id ) {
|
||||||
Throw "[$($MyInvocation.MyCommand.Name)] Please specify only -search or -id parameter , not both "
|
Throw "[$($MyInvocation.MyCommand.Name)] Please specify only -search or -id parameter , not both "
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($id) {
|
if ($id) {
|
||||||
$apiurl= "$url/api/v1/models/$id"
|
$api= "/api/v1/models/$id"
|
||||||
}
|
}
|
||||||
|
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = $apiurl
|
Api = $api
|
||||||
Method = 'Get'
|
Method = 'Get'
|
||||||
Token = $apiKey
|
|
||||||
GetParameters = $SearchParameter
|
GetParameters = $SearchParameter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
process {
|
||||||
if ($all) {
|
if ($all) {
|
||||||
$offstart = $(if($offset){$offset} Else {0})
|
$offstart = $(if ($offset) {$offset} Else {0})
|
||||||
$callargs = $SearchParameter
|
$callargs = $SearchParameter
|
||||||
$callargs.Remove('all')
|
$callargs.Remove('all')
|
||||||
|
|
||||||
|
|
@ -101,4 +112,12 @@ function Get-SnipeitModel()
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
$result
|
$result
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,10 +18,10 @@ Offset to use
|
||||||
A return all results, works with -offset and other parameters
|
A return all results, works with -offset and other parameters
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Get-SnipeitStatus -search "Ready to Deploy"
|
Get-SnipeitStatus -search "Ready to Deploy"
|
||||||
|
|
@ -31,8 +31,7 @@ Get-SnipeitStatus -id 3
|
||||||
|
|
||||||
#>
|
#>
|
||||||
|
|
||||||
function Get-SnipeitStatus()
|
function Get-SnipeitStatus() {
|
||||||
{
|
|
||||||
[CmdletBinding(DefaultParameterSetName = 'Search')]
|
[CmdletBinding(DefaultParameterSetName = 'Search')]
|
||||||
Param(
|
Param(
|
||||||
[parameter(ParameterSetName='Search')]
|
[parameter(ParameterSetName='Search')]
|
||||||
|
|
@ -54,36 +53,47 @@ function Get-SnipeitStatus()
|
||||||
[parameter(ParameterSetName='Search')]
|
[parameter(ParameterSetName='Search')]
|
||||||
[switch]$all = $false,
|
[switch]$all = $false,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
begin {
|
||||||
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
||||||
|
|
||||||
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
|
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
|
||||||
|
|
||||||
$apiurl = "$url/api/v1/statuslabels"
|
$api = "/api/v1/statuslabels"
|
||||||
|
|
||||||
if ($search -and $id ) {
|
if ($search -and $id ) {
|
||||||
Throw "[$($MyInvocation.MyCommand.Name)] Please specify only -search or -id parameter , not both "
|
Throw "[$($MyInvocation.MyCommand.Name)] Please specify only -search or -id parameter , not both "
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($id) {
|
if ($id) {
|
||||||
$apiurl= "$url/api/v1/statuslabels/$id"
|
$api= "/api/v1/statuslabels/$id"
|
||||||
}
|
}
|
||||||
|
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = $apiurl
|
Api = $api
|
||||||
Method = 'Get'
|
Method = 'Get'
|
||||||
Token = $apiKey
|
|
||||||
GetParameters = $SearchParameter
|
GetParameters = $SearchParameter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
process {
|
||||||
if ($all) {
|
if ($all) {
|
||||||
$offstart = $(if($offset){$offset} Else {0})
|
$offstart = $(if ($offset) {$offset} Else {0})
|
||||||
$callargs = $SearchParameter
|
$callargs = $SearchParameter
|
||||||
$callargs.Remove('all')
|
$callargs.Remove('all')
|
||||||
|
|
||||||
|
|
@ -101,4 +111,12 @@ function Get-SnipeitStatus()
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
$result
|
$result
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,10 +18,10 @@ Offset to use
|
||||||
A return all results, works with -offset and other parameters
|
A return all results, works with -offset and other parameters
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Get-SnipeitSupplier -search MySupplier
|
Get-SnipeitSupplier -search MySupplier
|
||||||
|
|
@ -30,8 +30,7 @@ Get-SnipeitSupplier -search MySupplier
|
||||||
Get-SnipeitSupplier -id 2
|
Get-SnipeitSupplier -id 2
|
||||||
|
|
||||||
#>
|
#>
|
||||||
function Get-SnipeitSupplier()
|
function Get-SnipeitSupplier() {
|
||||||
{
|
|
||||||
[CmdletBinding(DefaultParameterSetName = 'Search')]
|
[CmdletBinding(DefaultParameterSetName = 'Search')]
|
||||||
Param(
|
Param(
|
||||||
[parameter(ParameterSetName='Search')]
|
[parameter(ParameterSetName='Search')]
|
||||||
|
|
@ -53,36 +52,48 @@ function Get-SnipeitSupplier()
|
||||||
[parameter(ParameterSetName='Search')]
|
[parameter(ParameterSetName='Search')]
|
||||||
[switch]$all = $false,
|
[switch]$all = $false,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
|
||||||
|
begin {
|
||||||
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
||||||
|
|
||||||
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
|
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
|
||||||
|
|
||||||
$apiurl = "$url/api/v1/suppliers"
|
$api = "/api/v1/suppliers"
|
||||||
|
|
||||||
if ($search -and $id ) {
|
if ($search -and $id ) {
|
||||||
Throw "[$($MyInvocation.MyCommand.Name)] Please specify only -search or -id parameter , not both "
|
Throw "[$($MyInvocation.MyCommand.Name)] Please specify only -search or -id parameter , not both "
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($id) {
|
if ($id) {
|
||||||
$apiurl= "$url/api/v1/suppliers/$id"
|
$api= "/api/v1/suppliers/$id"
|
||||||
}
|
}
|
||||||
|
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = $apiurl
|
Api = $api
|
||||||
Method = 'Get'
|
Method = 'Get'
|
||||||
Token = $apiKey
|
|
||||||
GetParameters = $SearchParameter
|
GetParameters = $SearchParameter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
process {
|
||||||
if ($all) {
|
if ($all) {
|
||||||
$offstart = $(if($offset){$offset} Else {0})
|
$offstart = $(if ($offset) {$offset} Else {0})
|
||||||
$callargs = $SearchParameter
|
$callargs = $SearchParameter
|
||||||
$callargs.Remove('all')
|
$callargs.Remove('all')
|
||||||
|
|
||||||
|
|
@ -100,5 +111,12 @@ function Get-SnipeitSupplier()
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
$result
|
$result
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,10 +24,10 @@ Offset to use
|
||||||
A return all results, works with -offset and other parameters
|
A return all results, works with -offset and other parameters
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Get-SnipeitUser -search SomeSurname
|
Get-SnipeitUser -search SomeSurname
|
||||||
|
|
@ -90,31 +90,42 @@ function Get-SnipeitUser() {
|
||||||
[parameter(ParameterSetName='Get users a specific accessory id has been checked out to')]
|
[parameter(ParameterSetName='Get users a specific accessory id has been checked out to')]
|
||||||
[switch]$all = $false,
|
[switch]$all = $false,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
|
||||||
|
begin {
|
||||||
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
||||||
|
|
||||||
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
|
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
|
||||||
switch ($PsCmdlet.ParameterSetName) {
|
switch ($PsCmdlet.ParameterSetName) {
|
||||||
'Search' { $apiurl = "$url/api/v1/users"}
|
'Search' { $api = "/api/v1/users"}
|
||||||
'Get with id' {$apiurl= "$url/api/v1/users/$id"}
|
'Get with id' {$api= "/api/v1/users/$id"}
|
||||||
'Get users a specific accessory id has been checked out to' {$apiurl= "$url/api/v1/accessories/$accessory_id/checkedout"}
|
'Get users a specific accessory id has been checked out to' {$api= "/api/v1/accessories/$accessory_id/checkedout"}
|
||||||
}
|
}
|
||||||
|
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = $apiurl
|
Api = $api
|
||||||
Method = 'Get'
|
Method = 'Get'
|
||||||
GetParameters = $SearchParameter
|
GetParameters = $SearchParameter
|
||||||
Token = $apiKey
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
}
|
||||||
|
process {
|
||||||
if ($all) {
|
if ($all) {
|
||||||
$offstart = $(if($offset){$offset} Else {0})
|
$offstart = $(if ($offset) {$offset} Else {0})
|
||||||
$callargs = $SearchParameter
|
$callargs = $SearchParameter
|
||||||
$callargs.Remove('all')
|
$callargs.Remove('all')
|
||||||
|
|
||||||
|
|
@ -132,4 +143,12 @@ function Get-SnipeitUser() {
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
$result
|
$result
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -57,10 +57,10 @@ Min quantity of the accessory before alert is triggered
|
||||||
Accessory image fileame and path
|
Accessory image fileame and path
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
New-SnipeitAccessory -name "Accessory" -qty 3 -category_id 1
|
New-SnipeitAccessory -name "Accessory" -qty 3 -category_id 1
|
||||||
|
|
@ -109,13 +109,13 @@ function New-SnipeitAccessory() {
|
||||||
[ValidateScript({Test-Path $_})]
|
[ValidateScript({Test-Path $_})]
|
||||||
[string]$image,
|
[string]$image,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
begin {
|
||||||
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
||||||
|
|
||||||
$Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
|
$Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
|
||||||
|
|
@ -125,16 +125,34 @@ function New-SnipeitAccessory() {
|
||||||
}
|
}
|
||||||
|
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/accessories"
|
Api = "/api/v1/accessories"
|
||||||
Method = 'POST'
|
Method = 'POST'
|
||||||
Body = $Values
|
Body = $Values
|
||||||
Token = $apiKey
|
|
||||||
}
|
}
|
||||||
|
|
||||||
If ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
process {
|
||||||
|
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
}
|
}
|
||||||
|
|
||||||
$result
|
$result
|
||||||
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,10 +52,10 @@ Id of target user , location or asset
|
||||||
Checkout asset when creating to one of following types user, location or asset.
|
Checkout asset when creating to one of following types user, location or asset.
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
|
||||||
|
|
||||||
.PARAMETER customfields
|
.PARAMETER customfields
|
||||||
Hastable of custom fields and extra fields that need passing through to Snipeit.
|
Hastable of custom fields and extra fields that need passing through to Snipeit.
|
||||||
|
|
@ -74,8 +74,7 @@ New-SnipeitAsset -status_id 1 -model_id 1 -name "Machine1" -customfields = @{ "_
|
||||||
Using customfields when creating asset.
|
Using customfields when creating asset.
|
||||||
#>
|
#>
|
||||||
|
|
||||||
function New-SnipeitAsset()
|
function New-SnipeitAsset() {
|
||||||
{
|
|
||||||
[CmdletBinding(
|
[CmdletBinding(
|
||||||
SupportsShouldProcess = $true,
|
SupportsShouldProcess = $true,
|
||||||
ConfirmImpact = "Low",
|
ConfirmImpact = "Low",
|
||||||
|
|
@ -135,16 +134,17 @@ function New-SnipeitAsset()
|
||||||
[ValidateSet("location","asset","user")]
|
[ValidateSet("location","asset","user")]
|
||||||
[string] $checkout_to_type = "user",
|
[string] $checkout_to_type = "user",
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$apiKey,
|
[string]$apiKey,
|
||||||
|
|
||||||
[Alias('CustomValues')]
|
[Alias('CustomValues')]
|
||||||
[hashtable] $customfields
|
[hashtable] $customfields
|
||||||
)
|
)
|
||||||
|
|
||||||
|
begin {
|
||||||
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
||||||
|
|
||||||
$Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
|
$Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
|
||||||
|
|
@ -153,35 +153,52 @@ function New-SnipeitAsset()
|
||||||
$values['purchase_date'] = $values['purchase_date'].ToString("yyyy-MM-dd")
|
$values['purchase_date'] = $values['purchase_date'].ToString("yyyy-MM-dd")
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($customfields)
|
if ($customfields) {
|
||||||
{
|
|
||||||
$Values += $customfields
|
$Values += $customfields
|
||||||
}
|
}
|
||||||
|
|
||||||
#Checkout asset when creating it
|
#Checkout asset when creating it
|
||||||
if ($PsCmdlet.ParameterSetName -eq 'Checkout asset when creating'){
|
if ($PsCmdlet.ParameterSetName -eq 'Checkout asset when creating') {
|
||||||
switch ($checkout_to_type){
|
switch ($checkout_to_type) {
|
||||||
'location' { $Values += @{ "assigned_location" = $assigned_id } }
|
'location' { $Values += @{ "assigned_location" = $assigned_id } }
|
||||||
'user' { $Values += @{ "assigned_user" = $assigned_id } }
|
'user' { $Values += @{ "assigned_user" = $assigned_id } }
|
||||||
'asset' { $Values += @{ "assigned_asset" = $assigned_id } }
|
'asset' { $Values += @{ "assigned_asset" = $assigned_id } }
|
||||||
}
|
}
|
||||||
|
|
||||||
#This are not needed for API
|
#This are not needed for API
|
||||||
if($Values.ContainsKey('assigned_id')){$Values.Remove('assigned_id')}
|
if ($Values.ContainsKey('assigned_id')) {$Values.Remove('assigned_id')}
|
||||||
if($Values.ContainsKey('checkout_to_type')){$Values.Remove('checkout_to_type')}
|
if ($Values.ContainsKey('checkout_to_type')) {$Values.Remove('checkout_to_type')}
|
||||||
}
|
}
|
||||||
|
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/hardware"
|
Api = "/api/v1/hardware"
|
||||||
Method = 'Post'
|
Method = 'Post'
|
||||||
Body = $Values
|
Body = $Values
|
||||||
Token = $apiKey
|
|
||||||
}
|
}
|
||||||
|
|
||||||
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
{
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
process {
|
||||||
|
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
}
|
}
|
||||||
|
|
||||||
$result
|
$result
|
||||||
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,10 +31,10 @@ Optional completion date
|
||||||
Optional cost
|
Optional cost
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
New-SnipeitAssetMaintenence -asset_id 1 -supplier_id 1 -title "replace keyboard" -start_date 2021-01-01
|
New-SnipeitAssetMaintenence -asset_id 1 -supplier_id 1 -title "replace keyboard" -start_date 2021-01-01
|
||||||
|
|
@ -70,13 +70,13 @@ function New-SnipeitAssetMaintenance() {
|
||||||
|
|
||||||
[string]$notes,
|
[string]$notes,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
begin {
|
||||||
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
||||||
|
|
||||||
$Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
|
$Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
|
||||||
|
|
@ -91,15 +91,34 @@ function New-SnipeitAssetMaintenance() {
|
||||||
|
|
||||||
|
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/maintenances"
|
Api = "/api/v1/maintenances"
|
||||||
Method = 'Post'
|
Method = 'Post'
|
||||||
Body = $Values
|
Body = $Values
|
||||||
Token = $apiKey
|
|
||||||
}
|
}
|
||||||
|
|
||||||
If ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
process {
|
||||||
|
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
}
|
}
|
||||||
|
|
||||||
$result
|
$result
|
||||||
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,7 @@ New-SnipeitAudit -tag 1 -location_id 1
|
||||||
|
|
||||||
#>
|
#>
|
||||||
|
|
||||||
function New-SnipeitAudit()
|
function New-SnipeitAudit() {
|
||||||
{
|
|
||||||
[CmdletBinding(
|
[CmdletBinding(
|
||||||
SupportsShouldProcess = $true,
|
SupportsShouldProcess = $true,
|
||||||
ConfirmImpact = "Low"
|
ConfirmImpact = "Low"
|
||||||
|
|
@ -29,36 +28,53 @@ function New-SnipeitAudit()
|
||||||
|
|
||||||
[int]$location_id,
|
[int]$location_id,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
|
|
||||||
)
|
)
|
||||||
|
begin {
|
||||||
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
||||||
|
|
||||||
$Values = @{
|
$Values = @{
|
||||||
"location_id" = $location_id
|
"location_id" = $location_id
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($PSBoundParameters.ContainsKey('tag'))
|
if ($PSBoundParameters.ContainsKey('tag')) {
|
||||||
{
|
|
||||||
$Values += @{"asset_tag" = $tag}
|
$Values += @{"asset_tag" = $tag}
|
||||||
}
|
}
|
||||||
|
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/hardware/audit"
|
Api = "/api/v1/hardware/audit"
|
||||||
Method = 'Post'
|
Method = 'Post'
|
||||||
Body = $Values
|
Body = $Values
|
||||||
Token = $apiKey
|
|
||||||
}
|
}
|
||||||
|
|
||||||
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
{
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
process {
|
||||||
|
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
}
|
}
|
||||||
|
|
||||||
$result
|
$result
|
||||||
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,17 +24,16 @@ If switch is present, send email to user on checkin/checkout
|
||||||
Category image filename and path
|
Category image filename and path
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
User's API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
New-SnipeitCategory -name "Laptops" -category_type asset -url "Snipe-IT URL here..." -apiKey "API key here..."
|
New-SnipeitCategory -name "Laptops" -category_type asset
|
||||||
#>
|
#>
|
||||||
|
|
||||||
function New-SnipeitCategory()
|
function New-SnipeitCategory() {
|
||||||
{
|
|
||||||
[CmdletBinding(
|
[CmdletBinding(
|
||||||
SupportsShouldProcess = $true,
|
SupportsShouldProcess = $true,
|
||||||
ConfirmImpact = "Low"
|
ConfirmImpact = "Low"
|
||||||
|
|
@ -59,17 +58,17 @@ function New-SnipeitCategory()
|
||||||
[ValidateScript({Test-Path $_})]
|
[ValidateScript({Test-Path $_})]
|
||||||
[string]$image,
|
[string]$image,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
|
|
||||||
)
|
)
|
||||||
begin {
|
begin {
|
||||||
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
||||||
|
|
||||||
if($eula_text -and $use_default_eula){
|
if ($eula_text -and $use_default_eula) {
|
||||||
throw 'Dont use -use_defalt_eula if -eula_text is set'
|
throw 'Dont use -use_defalt_eula if -eula_text is set'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -79,17 +78,32 @@ function New-SnipeitCategory()
|
||||||
process {
|
process {
|
||||||
|
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/categories"
|
Api = "/api/v1/categories"
|
||||||
Method = 'POST'
|
Method = 'POST'
|
||||||
Body = $Values
|
Body = $Values
|
||||||
Token = $apiKey
|
|
||||||
}
|
}
|
||||||
|
|
||||||
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
{
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
}
|
}
|
||||||
|
|
||||||
$result
|
$result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,18 +12,17 @@ Comapany name
|
||||||
Company image filename and path
|
Company image filename and path
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
User's API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
New-SnipeitCompany -name "Acme Company"
|
New-SnipeitCompany -name "Acme Company"
|
||||||
|
|
||||||
#>
|
#>
|
||||||
|
|
||||||
function New-SnipeitCompany()
|
function New-SnipeitCompany() {
|
||||||
{
|
|
||||||
[CmdletBinding(
|
[CmdletBinding(
|
||||||
SupportsShouldProcess = $true,
|
SupportsShouldProcess = $true,
|
||||||
ConfirmImpact = "Low"
|
ConfirmImpact = "Low"
|
||||||
|
|
@ -36,29 +35,47 @@ function New-SnipeitCompany()
|
||||||
[ValidateScript({Test-Path $_})]
|
[ValidateScript({Test-Path $_})]
|
||||||
[string]$image,
|
[string]$image,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
begin {
|
||||||
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
||||||
|
|
||||||
$Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
|
$Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
|
||||||
|
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/companies"
|
Api = "/api/v1/companies"
|
||||||
Method = 'POST'
|
Method = 'POST'
|
||||||
Body = $Values
|
Body = $Values
|
||||||
Token = $apiKey
|
|
||||||
}
|
}
|
||||||
|
|
||||||
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
{
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
process {
|
||||||
|
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
}
|
}
|
||||||
|
|
||||||
$result
|
$result
|
||||||
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,16 +30,15 @@ Cost of item being purchased.
|
||||||
Component image filename and path
|
Component image filename and path
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
User's API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
An example
|
New-SnipeitComponent -name 'Display adapter' -catecory_id 3 -qty 10
|
||||||
|
|
||||||
|
|
||||||
.NOTES
|
|
||||||
General notes
|
|
||||||
#>
|
#>
|
||||||
|
|
||||||
function New-SnipeitComponent() {
|
function New-SnipeitComponent() {
|
||||||
|
|
@ -71,13 +70,13 @@ function New-SnipeitComponent() {
|
||||||
[ValidateScript({Test-Path $_})]
|
[ValidateScript({Test-Path $_})]
|
||||||
[string]$image,
|
[string]$image,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
begin {
|
||||||
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
||||||
|
|
||||||
$Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
|
$Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
|
||||||
|
|
@ -87,16 +86,35 @@ function New-SnipeitComponent() {
|
||||||
}
|
}
|
||||||
|
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/components"
|
Api = "/api/v1/components"
|
||||||
Method = 'POST'
|
Method = 'POST'
|
||||||
Body = $Values
|
Body = $Values
|
||||||
Token = $apiKey
|
|
||||||
}
|
}
|
||||||
|
|
||||||
If ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
process {
|
||||||
|
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
}
|
}
|
||||||
|
|
||||||
$result
|
$result
|
||||||
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -48,10 +48,10 @@ Item number for the consumable
|
||||||
Consumable Image filename and path
|
Consumable Image filename and path
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
|
||||||
|
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
|
|
@ -60,8 +60,7 @@ Create consumable with stock count 20 , alert when stock is 5 or lower
|
||||||
|
|
||||||
#>
|
#>
|
||||||
|
|
||||||
function New-SnipeitConsumable()
|
function New-SnipeitConsumable() {
|
||||||
{
|
|
||||||
[CmdletBinding(
|
[CmdletBinding(
|
||||||
SupportsShouldProcess = $true,
|
SupportsShouldProcess = $true,
|
||||||
ConfirmImpact = "Low"
|
ConfirmImpact = "Low"
|
||||||
|
|
@ -110,10 +109,10 @@ function New-SnipeitConsumable()
|
||||||
[ValidateScript({Test-Path $_})]
|
[ValidateScript({Test-Path $_})]
|
||||||
[string]$image,
|
[string]$image,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
@ -123,21 +122,36 @@ function New-SnipeitConsumable()
|
||||||
if ($Values['purchase_date']) {
|
if ($Values['purchase_date']) {
|
||||||
$Values['purchase_date'] = $Values['purchase_date'].ToString("yyyy-MM-dd")
|
$Values['purchase_date'] = $Values['purchase_date'].ToString("yyyy-MM-dd")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$Parameters = @{
|
||||||
|
Api = "/api/v1/consumables"
|
||||||
|
Method = 'Post'
|
||||||
|
Body = $Values
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
process {
|
process {
|
||||||
$Parameters = @{
|
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
||||||
Uri = "$url/api/v1/consumables"
|
|
||||||
Method = 'Post'
|
|
||||||
Body = $Values
|
|
||||||
Token = $apiKey
|
|
||||||
}
|
|
||||||
|
|
||||||
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
|
|
||||||
{
|
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
}
|
}
|
||||||
|
|
||||||
$result
|
$result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,17 +30,16 @@
|
||||||
Any additional text you wish to display under the new form field to make it clearer what the gauges should be.
|
Any additional text you wish to display under the new form field to make it clearer what the gauges should be.
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
New-SnipeitCustomField -Name "AntivirusInstalled" -Format "BOOLEAN" -HelpText "Is AntiVirus installed on Asset"
|
New-SnipeitCustomField -Name "AntivirusInstalled" -Format "BOOLEAN" -HelpText "Is AntiVirus installed on Asset"
|
||||||
#>
|
#>
|
||||||
|
|
||||||
function New-SnipeitCustomField()
|
function New-SnipeitCustomField() {
|
||||||
{
|
|
||||||
[CmdletBinding(
|
[CmdletBinding(
|
||||||
SupportsShouldProcess = $true,
|
SupportsShouldProcess = $true,
|
||||||
ConfirmImpact = "Low"
|
ConfirmImpact = "Low"
|
||||||
|
|
@ -68,10 +67,10 @@ function New-SnipeitCustomField()
|
||||||
|
|
||||||
[string]$custom_format,
|
[string]$custom_format,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -84,20 +83,33 @@ function New-SnipeitCustomField()
|
||||||
$Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
|
$Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
|
||||||
|
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/fields"
|
Api = "/api/v1/fields"
|
||||||
Method = 'post'
|
Method = 'post'
|
||||||
Body = $Values
|
Body = $Values
|
||||||
Token = $apiKey
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
process{
|
process{
|
||||||
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
|
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
||||||
{
|
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
}
|
}
|
||||||
|
|
||||||
$result
|
$result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,10 +21,10 @@
|
||||||
Department Image filename and path
|
Department Image filename and path
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
New-SnipeitDepartment -name "Department1" -company_id 1 -localtion_id 1 -manager_id 3
|
New-SnipeitDepartment -name "Department1" -company_id 1 -localtion_id 1 -manager_id 3
|
||||||
|
|
@ -54,28 +54,47 @@ function New-SnipeitDepartment() {
|
||||||
|
|
||||||
[switch]$image_delete=$false,
|
[switch]$image_delete=$false,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
begin {
|
||||||
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
||||||
|
|
||||||
$Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
|
$Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
|
||||||
|
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/departments"
|
Api = "/api/v1/departments"
|
||||||
Method = 'POST'
|
Method = 'POST'
|
||||||
Body = $Values
|
Body = $Values
|
||||||
Token = $apiKey
|
|
||||||
}
|
}
|
||||||
|
|
||||||
If ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
process {
|
||||||
|
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
}
|
}
|
||||||
|
|
||||||
$result
|
$result
|
||||||
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -57,10 +57,10 @@
|
||||||
Termination date for license.
|
Termination date for license.
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
New-SnipeitLicence -name "License" -seats 3 -company_id 1
|
New-SnipeitLicence -name "License" -seats 3 -company_id 1
|
||||||
|
|
@ -117,13 +117,13 @@ function New-SnipeitLicense() {
|
||||||
|
|
||||||
[datetime]$termination_date,
|
[datetime]$termination_date,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
begin {
|
||||||
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
||||||
|
|
||||||
$Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
|
$Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
|
||||||
|
|
@ -141,16 +141,34 @@ function New-SnipeitLicense() {
|
||||||
}
|
}
|
||||||
|
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/licenses"
|
Api = "/api/v1/licenses"
|
||||||
Method = 'POST'
|
Method = 'POST'
|
||||||
Body = $Values
|
Body = $Values
|
||||||
Token = $apiKey
|
|
||||||
}
|
}
|
||||||
|
|
||||||
If ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
process {
|
||||||
|
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
}
|
}
|
||||||
|
|
||||||
$result
|
$result
|
||||||
|
}
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,10 +42,10 @@
|
||||||
Location Image filename and path
|
Location Image filename and path
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
New-SnipeitLocation -name "Room 1" -address "123 Asset Street" -parent_id 14
|
New-SnipeitLocation -name "Room 1" -address "123 Asset Street" -parent_id 14
|
||||||
|
|
@ -86,27 +86,47 @@ function New-SnipeitLocation() {
|
||||||
|
|
||||||
[switch]$image_delete=$false,
|
[switch]$image_delete=$false,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
|
||||||
|
begin {
|
||||||
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
||||||
|
|
||||||
$Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
|
$Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
|
||||||
|
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/locations"
|
Api = "/api/v1/locations"
|
||||||
Method = 'post'
|
Method = 'post'
|
||||||
Body = $Values
|
Body = $Values
|
||||||
Token = $apiKey
|
|
||||||
}
|
}
|
||||||
|
|
||||||
If ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
process {
|
||||||
|
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
}
|
}
|
||||||
|
|
||||||
$result
|
$result
|
||||||
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,17 +15,16 @@
|
||||||
Remove current image
|
Remove current image
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
New-SnipeitManufacturer -name "HP"
|
New-SnipeitManufacturer -name "HP"
|
||||||
#>
|
#>
|
||||||
|
|
||||||
function New-SnipeitManufacturer()
|
function New-SnipeitManufacturer() {
|
||||||
{
|
|
||||||
[CmdletBinding(
|
[CmdletBinding(
|
||||||
SupportsShouldProcess = $true,
|
SupportsShouldProcess = $true,
|
||||||
ConfirmImpact = "Low"
|
ConfirmImpact = "Low"
|
||||||
|
|
@ -40,13 +39,14 @@ function New-SnipeitManufacturer()
|
||||||
|
|
||||||
[switch]$image_delete=$false,
|
[switch]$image_delete=$false,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
|
||||||
|
begin {
|
||||||
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
||||||
|
|
||||||
$Values = @{
|
$Values = @{
|
||||||
|
|
@ -54,16 +54,32 @@ function New-SnipeitManufacturer()
|
||||||
}
|
}
|
||||||
|
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/manufacturers"
|
Api = "/api/v1/manufacturers"
|
||||||
Method = 'post'
|
Method = 'post'
|
||||||
Body = $Values
|
Body = $Values
|
||||||
Token = $apiKey
|
|
||||||
}
|
}
|
||||||
|
|
||||||
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
{
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
}
|
||||||
|
process {
|
||||||
|
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
}
|
}
|
||||||
|
|
||||||
$result
|
$result
|
||||||
|
}
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,17 +24,16 @@
|
||||||
Asset model Image filename and path
|
Asset model Image filename and path
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
New-SnipeitModel -name "DL380" -manufacturer_id 2 -fieldset_id 2 -category_id 1
|
New-SnipeitModel -name "DL380" -manufacturer_id 2 -fieldset_id 2 -category_id 1
|
||||||
#>
|
#>
|
||||||
|
|
||||||
function New-SnipeitModel()
|
function New-SnipeitModel() {
|
||||||
{
|
|
||||||
[CmdletBinding(
|
[CmdletBinding(
|
||||||
SupportsShouldProcess = $true,
|
SupportsShouldProcess = $true,
|
||||||
ConfirmImpact = "Low"
|
ConfirmImpact = "Low"
|
||||||
|
|
@ -60,13 +59,14 @@ function New-SnipeitModel()
|
||||||
[ValidateScript({Test-Path $_})]
|
[ValidateScript({Test-Path $_})]
|
||||||
[string]$image,
|
[string]$image,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
|
||||||
|
begin {
|
||||||
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
||||||
|
|
||||||
$Values = @{
|
$Values = @{
|
||||||
|
|
@ -81,16 +81,34 @@ function New-SnipeitModel()
|
||||||
|
|
||||||
|
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/models"
|
Api = "/api/v1/models"
|
||||||
Method = 'post'
|
Method = 'post'
|
||||||
Body = $Values
|
Body = $Values
|
||||||
Token = $apiKey
|
|
||||||
}
|
}
|
||||||
|
|
||||||
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
{
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
process {
|
||||||
|
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
}
|
}
|
||||||
|
|
||||||
$result
|
$result
|
||||||
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -45,10 +45,10 @@
|
||||||
Image file name and path for item
|
Image file name and path for item
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
New-SnipeitDepartment -name "Department1" -company_id 1 -localtion_id 1 -manager_id 3
|
New-SnipeitDepartment -name "Department1" -company_id 1 -localtion_id 1 -manager_id 3
|
||||||
|
|
@ -90,28 +90,47 @@ function New-SnipeitSupplier() {
|
||||||
[ValidateScript({Test-Path $_})]
|
[ValidateScript({Test-Path $_})]
|
||||||
[string]$image,
|
[string]$image,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
begin {
|
||||||
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
||||||
|
|
||||||
$Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
|
$Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
|
||||||
|
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/suppilers"
|
Api = "/api/v1/suppilers"
|
||||||
Method = 'POST'
|
Method = 'POST'
|
||||||
Body = $Values
|
Body = $Values
|
||||||
Token = $apiKey
|
|
||||||
}
|
}
|
||||||
|
|
||||||
If ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
process {
|
||||||
|
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
}
|
}
|
||||||
|
|
||||||
$result
|
$result
|
||||||
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -54,10 +54,10 @@
|
||||||
User Image file name and path
|
User Image file name and path
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
User's API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
New-Snipeituser -fist_name It -lastname Snipe -username snipeit -activated $false -company_id 1 -location_id 1 -department_id 1
|
New-Snipeituser -fist_name It -lastname Snipe -username snipeit -activated $false -company_id 1 -location_id 1 -department_id 1
|
||||||
|
|
@ -110,13 +110,13 @@ function New-SnipeitUser() {
|
||||||
[ValidateScript({Test-Path $_})]
|
[ValidateScript({Test-Path $_})]
|
||||||
[string]$image,
|
[string]$image,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
begin {
|
||||||
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
||||||
|
|
||||||
$Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
|
$Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
|
||||||
|
|
@ -126,15 +126,34 @@ function New-SnipeitUser() {
|
||||||
}
|
}
|
||||||
|
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/users"
|
Api = "/api/v1/users"
|
||||||
Method = 'post'
|
Method = 'post'
|
||||||
Body = $Values
|
Body = $Values
|
||||||
Token = $apiKey
|
|
||||||
}
|
}
|
||||||
|
|
||||||
If ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
process {
|
||||||
|
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
}
|
}
|
||||||
|
|
||||||
$result
|
$result
|
||||||
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,10 @@
|
||||||
.PARAMETER ID
|
.PARAMETER ID
|
||||||
Unique ID For accessory to be removed
|
Unique ID For accessory to be removed
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
User's API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Remove-SnipeitAccessory -ID 44 -Verbose
|
Remove-SnipeitAccessory -ID 44 -Verbose
|
||||||
|
|
@ -18,8 +18,7 @@
|
||||||
Get-SnipeitAccessory -search needle | Remove-SnipeitAccessory
|
Get-SnipeitAccessory -search needle | Remove-SnipeitAccessory
|
||||||
#>
|
#>
|
||||||
|
|
||||||
function Remove-SnipeitAccessory ()
|
function Remove-SnipeitAccessory () {
|
||||||
{
|
|
||||||
[CmdletBinding(
|
[CmdletBinding(
|
||||||
SupportsShouldProcess = $true,
|
SupportsShouldProcess = $true,
|
||||||
ConfirmImpact = "Low"
|
ConfirmImpact = "Low"
|
||||||
|
|
@ -28,27 +27,46 @@ function Remove-SnipeitAccessory ()
|
||||||
Param(
|
Param(
|
||||||
[parameter(mandatory = $true,ValueFromPipelineByPropertyName)]
|
[parameter(mandatory = $true,ValueFromPipelineByPropertyName)]
|
||||||
[int[]]$id,
|
[int[]]$id,
|
||||||
[parameter(mandatory = $true)]
|
|
||||||
[string]$URL,
|
|
||||||
[parameter(mandatory = $true)]
|
|
||||||
[string]$APIKey
|
|
||||||
|
|
||||||
|
[parameter(mandatory = $false)]
|
||||||
|
[string]$url,
|
||||||
|
|
||||||
|
[parameter(mandatory = $false)]
|
||||||
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
|
||||||
begin {
|
begin {
|
||||||
}
|
}
|
||||||
|
|
||||||
process {
|
process {
|
||||||
foreach($accessory_id in $id){
|
foreach($accessory_id in $id) {
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/accessories/$accessory_id"
|
Api = "/api/v1/accessories/$accessory_id"
|
||||||
Method = 'Delete'
|
Method = 'Delete'
|
||||||
Token = $apiKey
|
|
||||||
}
|
}
|
||||||
|
|
||||||
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
{
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
}
|
}
|
||||||
|
|
||||||
$result
|
$result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,10 @@
|
||||||
.PARAMETER ID
|
.PARAMETER ID
|
||||||
Unique ID For Asset to be removed
|
Unique ID For Asset to be removed
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
User's API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Remove-SnipeitAsset -ID 44 -Verbose
|
Remove-SnipeitAsset -ID 44 -Verbose
|
||||||
|
|
@ -18,8 +18,7 @@
|
||||||
Get-SnipeitAsset -serial 123456789 | Remove-SnipeitAsset
|
Get-SnipeitAsset -serial 123456789 | Remove-SnipeitAsset
|
||||||
#>
|
#>
|
||||||
|
|
||||||
function Remove-SnipeitAsset ()
|
function Remove-SnipeitAsset () {
|
||||||
{
|
|
||||||
[CmdletBinding(
|
[CmdletBinding(
|
||||||
SupportsShouldProcess = $true,
|
SupportsShouldProcess = $true,
|
||||||
ConfirmImpact = "Low"
|
ConfirmImpact = "Low"
|
||||||
|
|
@ -28,28 +27,47 @@ function Remove-SnipeitAsset ()
|
||||||
Param(
|
Param(
|
||||||
[parameter(mandatory = $true,ValueFromPipelineByPropertyName)]
|
[parameter(mandatory = $true,ValueFromPipelineByPropertyName)]
|
||||||
[int[]]$id,
|
[int[]]$id,
|
||||||
[parameter(mandatory = $true)]
|
|
||||||
[string]$URL,
|
|
||||||
[parameter(mandatory = $true)]
|
|
||||||
[string]$APIKey
|
|
||||||
|
|
||||||
|
[parameter(mandatory = $false)]
|
||||||
|
[string]$url,
|
||||||
|
|
||||||
|
[parameter(mandatory = $false)]
|
||||||
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
|
||||||
begin {
|
begin {
|
||||||
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
||||||
}
|
}
|
||||||
|
|
||||||
process {
|
process {
|
||||||
foreach($asset_id in $id){
|
foreach($asset_id in $id) {
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/hardware/$asset_id"
|
Api = "/api/v1/hardware/$asset_id"
|
||||||
Method = 'Delete'
|
Method = 'Delete'
|
||||||
Token = $apiKey
|
|
||||||
}
|
}
|
||||||
|
|
||||||
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
{
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
}
|
}
|
||||||
|
|
||||||
$result
|
$result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
function Remove-SnipeitAssetMaintenance {
|
<#
|
||||||
<#
|
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Remove asset maintenance from Snipe-it asset system
|
Remove asset maintenance from Snipe-it asset system
|
||||||
|
|
||||||
|
|
@ -10,51 +9,64 @@ function Remove-SnipeitAssetMaintenance {
|
||||||
Unique ID of the asset maintenance to be removed
|
Unique ID of the asset maintenance to be removed
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfoeItInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
.PARAMETER url
|
||||||
.PARAMETER apiKey
|
Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit.
|
||||||
User's API Key for Snipeit, can be set using Set-SnipeitInfo command
|
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Remove-SnipeitAssetMaintenance -ID 44 -url $url -apiKey $secret -Verbose
|
Remove-SnipeitAssetMaintenance -ID 44
|
||||||
#>
|
#>
|
||||||
|
function Remove-SnipeitAssetMaintenance {
|
||||||
|
|
||||||
[CmdletBinding(
|
[CmdletBinding(
|
||||||
SupportsShouldProcess = $true,
|
SupportsShouldProcess = $true,
|
||||||
ConfirmImpact = "Low"
|
ConfirmImpact = "Low"
|
||||||
)]
|
)]
|
||||||
param (
|
param (
|
||||||
# Asset maintenance ID
|
|
||||||
[Parameter(Mandatory = $true,ValueFromPipelineByPropertyName)]
|
[Parameter(Mandatory = $true,ValueFromPipelineByPropertyName)]
|
||||||
[int[]]
|
[int[]]
|
||||||
$id,
|
$id,
|
||||||
|
|
||||||
# Snipeit URL
|
[parameter(mandatory = $false)]
|
||||||
[Parameter(Mandatory = $true)]
|
[string]$url,
|
||||||
[string]
|
|
||||||
$url,
|
|
||||||
|
|
||||||
# Snipeit ApiKey
|
[parameter(mandatory = $false)]
|
||||||
[Parameter(Mandatory = $true)]
|
[string]$apiKey
|
||||||
[string]
|
|
||||||
$apiKey
|
|
||||||
)
|
)
|
||||||
|
|
||||||
begin {
|
begin {
|
||||||
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
||||||
}
|
}
|
||||||
|
|
||||||
process {
|
process {
|
||||||
foreach($maintenance_id in $id){
|
foreach($maintenance_id in $id) {
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/maintenances/$maintenance_id"
|
Api = "/api/v1/maintenances/$maintenance_id"
|
||||||
Method = 'Delete'
|
Method = 'Delete'
|
||||||
Token = $apiKey
|
|
||||||
}
|
}
|
||||||
|
|
||||||
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
{
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
}
|
}
|
||||||
|
|
||||||
$result
|
$result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,20 +6,19 @@
|
||||||
.PARAMETER ID
|
.PARAMETER ID
|
||||||
Unique ID For categoryto be removed
|
Unique ID For categoryto be removed
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
User's API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Remove-SnipeitCategory -ID 44 -Verbose
|
Remove-SnipeitCategory -ID 44
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Get-SnipeitCategory -search something | Remove-SnipeitCategory
|
Get-SnipeitCategory -search something | Remove-SnipeitCategory
|
||||||
#>
|
#>
|
||||||
|
|
||||||
function Remove-SnipeitCategory ()
|
function Remove-SnipeitCategory () {
|
||||||
{
|
|
||||||
[CmdletBinding(
|
[CmdletBinding(
|
||||||
SupportsShouldProcess = $true,
|
SupportsShouldProcess = $true,
|
||||||
ConfirmImpact = "Low"
|
ConfirmImpact = "Low"
|
||||||
|
|
@ -28,27 +27,45 @@ function Remove-SnipeitCategory ()
|
||||||
Param(
|
Param(
|
||||||
[parameter(mandatory = $true,ValueFromPipelineByPropertyName)]
|
[parameter(mandatory = $true,ValueFromPipelineByPropertyName)]
|
||||||
[int[]]$id,
|
[int[]]$id,
|
||||||
[parameter(mandatory = $true)]
|
|
||||||
[string]$URL,
|
[parameter(mandatory = $false)]
|
||||||
[parameter(mandatory = $true)]
|
[string]$url,
|
||||||
[string]$APIKey
|
|
||||||
|
[parameter(mandatory = $false)]
|
||||||
|
[string]$apiKey
|
||||||
|
|
||||||
)
|
)
|
||||||
begin {
|
begin {
|
||||||
}
|
}
|
||||||
process {
|
process {
|
||||||
foreach($category_id in $id){
|
foreach($category_id in $id) {
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/categories/$category_id"
|
Api = "/api/v1/categories/$category_id"
|
||||||
Method = 'Delete'
|
Method = 'Delete'
|
||||||
Token = $apiKey
|
|
||||||
}
|
}
|
||||||
|
|
||||||
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
{
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
}
|
}
|
||||||
|
|
||||||
$result
|
$result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,20 +6,19 @@
|
||||||
.PARAMETER ID
|
.PARAMETER ID
|
||||||
Unique ID For Company to be removed
|
Unique ID For Company to be removed
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
User's API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Remove-SnipeitCompany -ID 44 -Verbose
|
Remove-SnipeitCompany -ID 44
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Get-SnipeitCompany | | Where-object {$_.name -like '*some*'} | Remove-SnipeitCompany
|
Get-SnipeitCompany | | Where-object {$_.name -like '*some*'} | Remove-SnipeitCompany
|
||||||
#>
|
#>
|
||||||
|
|
||||||
function Remove-SnipeitCompany ()
|
function Remove-SnipeitCompany () {
|
||||||
{
|
|
||||||
[CmdletBinding(
|
[CmdletBinding(
|
||||||
SupportsShouldProcess = $true,
|
SupportsShouldProcess = $true,
|
||||||
ConfirmImpact = "Low"
|
ConfirmImpact = "Low"
|
||||||
|
|
@ -28,27 +27,45 @@ function Remove-SnipeitCompany ()
|
||||||
Param(
|
Param(
|
||||||
[parameter(mandatory = $true,ValueFromPipelineByPropertyName)]
|
[parameter(mandatory = $true,ValueFromPipelineByPropertyName)]
|
||||||
[int[]]$id,
|
[int[]]$id,
|
||||||
[parameter(mandatory = $true)]
|
|
||||||
[string]$URL,
|
[parameter(mandatory = $false)]
|
||||||
[parameter(mandatory = $true)]
|
[string]$url,
|
||||||
[string]$APIKey
|
|
||||||
|
[parameter(mandatory = $false)]
|
||||||
|
[string]$apiKey
|
||||||
|
|
||||||
)
|
)
|
||||||
begin {
|
begin {
|
||||||
}
|
}
|
||||||
process {
|
process {
|
||||||
foreach($company_id in $id){
|
foreach($company_id in $id) {
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/companies/$company_id"
|
Api = "/api/v1/companies/$company_id"
|
||||||
Method = 'Delete'
|
Method = 'Delete'
|
||||||
Token = $apiKey
|
|
||||||
}
|
}
|
||||||
|
|
||||||
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
{
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
}
|
}
|
||||||
|
|
||||||
$result
|
$result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,20 +6,19 @@
|
||||||
.PARAMETER IDs
|
.PARAMETER IDs
|
||||||
Unique ID For component to be removed
|
Unique ID For component to be removed
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
User's API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Remove-SnipeitComponent -ID 44 -Verbose
|
Remove-SnipeitComponent -ID 44
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Get-SnipeitComponent -search 123456789 | Remove-SnipeitComponent
|
Get-SnipeitComponent -search 123456789 | Remove-SnipeitComponent
|
||||||
#>
|
#>
|
||||||
|
|
||||||
function Remove-SnipeitComponent ()
|
function Remove-SnipeitComponent () {
|
||||||
{
|
|
||||||
[CmdletBinding(
|
[CmdletBinding(
|
||||||
SupportsShouldProcess = $true,
|
SupportsShouldProcess = $true,
|
||||||
ConfirmImpact = "Low"
|
ConfirmImpact = "Low"
|
||||||
|
|
@ -28,27 +27,46 @@ function Remove-SnipeitComponent ()
|
||||||
Param(
|
Param(
|
||||||
[parameter(mandatory = $true,ValueFromPipelineByPropertyName)]
|
[parameter(mandatory = $true,ValueFromPipelineByPropertyName)]
|
||||||
[int[]]$id,
|
[int[]]$id,
|
||||||
[parameter(mandatory = $true)]
|
|
||||||
[string]$URL,
|
|
||||||
[parameter(mandatory = $true)]
|
|
||||||
[string]$APIKey
|
|
||||||
|
|
||||||
|
[parameter(mandatory = $false)]
|
||||||
|
[string]$url,
|
||||||
|
|
||||||
|
[parameter(mandatory = $false)]
|
||||||
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
|
||||||
begin {
|
begin {
|
||||||
}
|
}
|
||||||
|
|
||||||
process {
|
process {
|
||||||
foreach($component_id in $id){
|
foreach($component_id in $id) {
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/components/$component_id"
|
Api = "/api/v1/components/$component_id"
|
||||||
Method = 'Delete'
|
Method = 'Delete'
|
||||||
Token = $apiKey
|
|
||||||
}
|
}
|
||||||
|
|
||||||
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
{
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
}
|
}
|
||||||
|
|
||||||
$result
|
$result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,20 +7,19 @@
|
||||||
Unique ID For consumable to be removed
|
Unique ID For consumable to be removed
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
User's API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Remove-SnipeitConsumable -ID 44 -Verbose
|
Remove-SnipeitConsumable -ID 44
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Get-SnipeitConsumable -search "paper" | Remove-Snipeitconsumable
|
Get-SnipeitConsumable -search "paper" | Remove-SnipeitConsumable
|
||||||
#>
|
#>
|
||||||
|
|
||||||
function Remove-SnipeitConsumable ()
|
function Remove-SnipeitConsumable () {
|
||||||
{
|
|
||||||
[CmdletBinding(
|
[CmdletBinding(
|
||||||
SupportsShouldProcess = $true,
|
SupportsShouldProcess = $true,
|
||||||
ConfirmImpact = "Low"
|
ConfirmImpact = "Low"
|
||||||
|
|
@ -29,27 +28,46 @@ function Remove-SnipeitConsumable ()
|
||||||
Param(
|
Param(
|
||||||
[parameter(mandatory = $true,ValueFromPipelineByPropertyName)]
|
[parameter(mandatory = $true,ValueFromPipelineByPropertyName)]
|
||||||
[int[]]$id,
|
[int[]]$id,
|
||||||
[parameter(mandatory = $true)]
|
|
||||||
[string]$URL,
|
|
||||||
[parameter(mandatory = $true)]
|
|
||||||
[string]$APIKey
|
|
||||||
|
|
||||||
|
[parameter(mandatory = $false)]
|
||||||
|
[string]$url,
|
||||||
|
|
||||||
|
[parameter(mandatory = $false)]
|
||||||
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
|
||||||
begin {
|
begin {
|
||||||
}
|
}
|
||||||
|
|
||||||
process {
|
process {
|
||||||
foreach($consumable_id in $id){
|
foreach($consumable_id in $id) {
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/consumables/$consumable_id"
|
Api = "/api/v1/consumables/$consumable_id"
|
||||||
Method = 'Delete'
|
Method = 'Delete'
|
||||||
Token = $apiKey
|
|
||||||
}
|
}
|
||||||
|
|
||||||
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
{
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
}
|
}
|
||||||
|
|
||||||
$result
|
$result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,10 @@
|
||||||
.PARAMETER ID
|
.PARAMETER ID
|
||||||
Unique ID For field to be removed
|
Unique ID For field to be removed
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
User's API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Remove-SnipeitCustomField -ID 44 -Verbose
|
Remove-SnipeitCustomField -ID 44 -Verbose
|
||||||
|
|
@ -18,8 +18,7 @@
|
||||||
Get-SnipeitCustomField | Where-object {$_.name -like '*address*'} | Remove-SnipeitCustomField
|
Get-SnipeitCustomField | Where-object {$_.name -like '*address*'} | Remove-SnipeitCustomField
|
||||||
#>
|
#>
|
||||||
|
|
||||||
function Remove-SnipeitCustomField ()
|
function Remove-SnipeitCustomField () {
|
||||||
{
|
|
||||||
[CmdletBinding(
|
[CmdletBinding(
|
||||||
SupportsShouldProcess = $true,
|
SupportsShouldProcess = $true,
|
||||||
ConfirmImpact = "Low"
|
ConfirmImpact = "Low"
|
||||||
|
|
@ -28,27 +27,44 @@ function Remove-SnipeitCustomField ()
|
||||||
Param(
|
Param(
|
||||||
[parameter(mandatory = $true,ValueFromPipelineByPropertyName)]
|
[parameter(mandatory = $true,ValueFromPipelineByPropertyName)]
|
||||||
[int[]]$id,
|
[int[]]$id,
|
||||||
[parameter(mandatory = $true)]
|
|
||||||
[string]$URL,
|
|
||||||
[parameter(mandatory = $true)]
|
|
||||||
[string]$APIKey
|
|
||||||
|
|
||||||
|
[parameter(mandatory = $false)]
|
||||||
|
[string]$url,
|
||||||
|
|
||||||
|
[parameter(mandatory = $false)]
|
||||||
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
begin {
|
begin {
|
||||||
}
|
}
|
||||||
process {
|
process {
|
||||||
foreach($field_id in $id){
|
foreach($field_id in $id) {
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/fields/$field_id"
|
Api = "/api/v1/fields/$field_id"
|
||||||
Method = 'Delete'
|
Method = 'Delete'
|
||||||
Token = $apiKey
|
|
||||||
}
|
}
|
||||||
|
|
||||||
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
{
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
}
|
}
|
||||||
|
|
||||||
$result
|
$result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,20 +6,19 @@
|
||||||
.PARAMETER ID
|
.PARAMETER ID
|
||||||
Unique ID For department to be removed
|
Unique ID For department to be removed
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
User's API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Remove-SnipeitDepartment -ID 44 -Verbose
|
Remove-SnipeitDepartment -ID 44
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Get-SnipeitDepartment | Where-object {$_.name -like '*head*'} | Remove-SnipeitDepartment
|
Get-SnipeitDepartment | Where-object {$_.name -like '*head*'} | Remove-SnipeitDepartment
|
||||||
#>
|
#>
|
||||||
|
|
||||||
function Remove-SnipeitDepartment ()
|
function Remove-SnipeitDepartment () {
|
||||||
{
|
|
||||||
[CmdletBinding(
|
[CmdletBinding(
|
||||||
SupportsShouldProcess = $true,
|
SupportsShouldProcess = $true,
|
||||||
ConfirmImpact = "Low"
|
ConfirmImpact = "Low"
|
||||||
|
|
@ -28,27 +27,45 @@ function Remove-SnipeitDepartment ()
|
||||||
Param(
|
Param(
|
||||||
[parameter(mandatory = $true,ValueFromPipelineByPropertyName)]
|
[parameter(mandatory = $true,ValueFromPipelineByPropertyName)]
|
||||||
[int[]]$id,
|
[int[]]$id,
|
||||||
[parameter(mandatory = $true)]
|
|
||||||
[string]$URL,
|
[parameter(mandatory = $false)]
|
||||||
[parameter(mandatory = $true)]
|
[string]$url,
|
||||||
[string]$APIKey
|
|
||||||
|
[parameter(mandatory = $false)]
|
||||||
|
[string]$apiKey
|
||||||
|
|
||||||
)
|
)
|
||||||
begin {
|
begin {
|
||||||
}
|
}
|
||||||
process {
|
process {
|
||||||
foreach($department_id in $id){
|
foreach($department_id in $id) {
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/departments/$department_id"
|
Api = "/api/v1/departments/$department_id"
|
||||||
Method = 'Delete'
|
Method = 'Delete'
|
||||||
Token = $apiKey
|
|
||||||
}
|
}
|
||||||
|
|
||||||
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
{
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
}
|
}
|
||||||
|
|
||||||
$result
|
$result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,20 +6,19 @@
|
||||||
.PARAMETER ID
|
.PARAMETER ID
|
||||||
Unique ID For licence to be removed
|
Unique ID For licence to be removed
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
User's API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Remove-SnipeitLicence -ID 44 -Verbose
|
Remove-SnipeitLicence -ID 44
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Get-SnipeitLicence -product_key 123456789 | Remove-SnipeitLicense
|
Get-SnipeitLicence -product_key 123456789 | Remove-SnipeitLicense
|
||||||
#>
|
#>
|
||||||
|
|
||||||
function Remove-SnipeitLicense ()
|
function Remove-SnipeitLicense () {
|
||||||
{
|
|
||||||
[CmdletBinding(
|
[CmdletBinding(
|
||||||
SupportsShouldProcess = $true,
|
SupportsShouldProcess = $true,
|
||||||
ConfirmImpact = "Low"
|
ConfirmImpact = "Low"
|
||||||
|
|
@ -28,27 +27,46 @@ function Remove-SnipeitLicense ()
|
||||||
Param(
|
Param(
|
||||||
[parameter(mandatory = $true,ValueFromPipelineByPropertyName)]
|
[parameter(mandatory = $true,ValueFromPipelineByPropertyName)]
|
||||||
[int[]]$id,
|
[int[]]$id,
|
||||||
[parameter(mandatory = $true)]
|
|
||||||
[string]$URL,
|
|
||||||
[parameter(mandatory = $true)]
|
|
||||||
[string]$APIKey
|
|
||||||
|
|
||||||
|
[parameter(mandatory = $false)]
|
||||||
|
[string]$url,
|
||||||
|
|
||||||
|
[parameter(mandatory = $false)]
|
||||||
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
|
||||||
begin {
|
begin {
|
||||||
}
|
}
|
||||||
|
|
||||||
process {
|
process {
|
||||||
foreach($license_id in $id){
|
foreach($license_id in $id) {
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/licenses/$license_id"
|
Api = "/api/v1/licenses/$license_id"
|
||||||
Method = 'Delete'
|
Method = 'Delete'
|
||||||
Token = $apiKey
|
|
||||||
}
|
}
|
||||||
|
|
||||||
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
{
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
}
|
}
|
||||||
|
|
||||||
$result
|
$result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,20 +6,19 @@
|
||||||
.PARAMETER ID
|
.PARAMETER ID
|
||||||
Unique ID For location to be removed
|
Unique ID For location to be removed
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
User's API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Remove-SnipeitLocation -ID 44 -Verbose
|
Remove-SnipeitLocation -ID 44
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Get-SnipeitLocation -city Arkham | Remove-SnipeitLocation
|
Get-SnipeitLocation -city Arkham | Remove-SnipeitLocation
|
||||||
#>
|
#>
|
||||||
|
|
||||||
function Remove-SnipeitLocation ()
|
function Remove-SnipeitLocation () {
|
||||||
{
|
|
||||||
[CmdletBinding(
|
[CmdletBinding(
|
||||||
SupportsShouldProcess = $true,
|
SupportsShouldProcess = $true,
|
||||||
ConfirmImpact = "Low"
|
ConfirmImpact = "Low"
|
||||||
|
|
@ -28,27 +27,46 @@ function Remove-SnipeitLocation ()
|
||||||
Param(
|
Param(
|
||||||
[parameter(mandatory = $true,ValueFromPipelineByPropertyName)]
|
[parameter(mandatory = $true,ValueFromPipelineByPropertyName)]
|
||||||
[int[]]$id,
|
[int[]]$id,
|
||||||
[parameter(mandatory = $true)]
|
|
||||||
[string]$URL,
|
|
||||||
[parameter(mandatory = $true)]
|
|
||||||
[string]$APIKey
|
|
||||||
|
|
||||||
|
[parameter(mandatory = $false)]
|
||||||
|
[string]$url,
|
||||||
|
|
||||||
|
[parameter(mandatory = $false)]
|
||||||
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
|
||||||
begin {
|
begin {
|
||||||
}
|
}
|
||||||
|
|
||||||
process {
|
process {
|
||||||
foreach($location_id in $id){
|
foreach($location_id in $id) {
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/locations/$asset_id"
|
Api = "/api/v1/locations/$asset_id"
|
||||||
Method = 'Delete'
|
Method = 'Delete'
|
||||||
Token = $apiKey
|
|
||||||
}
|
}
|
||||||
|
|
||||||
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
{
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
}
|
}
|
||||||
|
|
||||||
$result
|
$result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,20 +6,19 @@
|
||||||
.PARAMETER ID
|
.PARAMETER ID
|
||||||
Unique ID For manufacturer to be removed
|
Unique ID For manufacturer to be removed
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
User's API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Remove-SnipeitManufacturer -ID 44 -Verbose
|
Remove-SnipeitManufacturer -ID 44
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Get-SnipeitManufacturer | Where-object {$_.name -like '*something*'} | Remove-SnipeitManufacturer
|
Get-SnipeitManufacturer | Where-object {$_.name -like '*something*'} | Remove-SnipeitManufacturer
|
||||||
#>
|
#>
|
||||||
|
|
||||||
function Remove-SnipeitManufacturer ()
|
function Remove-SnipeitManufacturer () {
|
||||||
{
|
|
||||||
[CmdletBinding(
|
[CmdletBinding(
|
||||||
SupportsShouldProcess = $true,
|
SupportsShouldProcess = $true,
|
||||||
ConfirmImpact = "Low"
|
ConfirmImpact = "Low"
|
||||||
|
|
@ -28,27 +27,47 @@ function Remove-SnipeitManufacturer ()
|
||||||
Param(
|
Param(
|
||||||
[parameter(mandatory = $true,ValueFromPipelineByPropertyName)]
|
[parameter(mandatory = $true,ValueFromPipelineByPropertyName)]
|
||||||
[int[]]$id,
|
[int[]]$id,
|
||||||
[parameter(mandatory = $true)]
|
|
||||||
[string]$URL,
|
|
||||||
[parameter(mandatory = $true)]
|
|
||||||
[string]$APIKey
|
|
||||||
|
|
||||||
|
[parameter(mandatory = $false)]
|
||||||
|
[string]$url,
|
||||||
|
|
||||||
|
[parameter(mandatory = $false)]
|
||||||
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
|
||||||
begin {
|
begin {
|
||||||
}
|
}
|
||||||
|
|
||||||
process {
|
process {
|
||||||
foreach($manufacturer_id in $id){
|
foreach($manufacturer_id in $id) {
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/manufacturers/$manufacturer_id"
|
Api = "/api/v1/manufacturers/$manufacturer_id"
|
||||||
Method = 'Delete'
|
Method = 'Delete'
|
||||||
Token = $apiKey
|
|
||||||
}
|
}
|
||||||
|
|
||||||
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
{
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
}
|
}
|
||||||
|
|
||||||
$result
|
$result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,20 +6,19 @@
|
||||||
.PARAMETER ID
|
.PARAMETER ID
|
||||||
Unique ID For Model to be removed
|
Unique ID For Model to be removed
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
User's API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Remove-SnipeitModel -ID 44 -Verbose
|
Remove-SnipeitModel -ID 44
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Get-SnipeitModel -search needle | Remove-SnipeitModel
|
Get-SnipeitModel -search needle | Remove-SnipeitModel
|
||||||
#>
|
#>
|
||||||
|
|
||||||
function Remove-SnipeitModel ()
|
function Remove-SnipeitModel () {
|
||||||
{
|
|
||||||
[CmdletBinding(
|
[CmdletBinding(
|
||||||
SupportsShouldProcess = $true,
|
SupportsShouldProcess = $true,
|
||||||
ConfirmImpact = "Low"
|
ConfirmImpact = "Low"
|
||||||
|
|
@ -28,27 +27,46 @@ function Remove-SnipeitModel ()
|
||||||
Param(
|
Param(
|
||||||
[parameter(mandatory = $true,ValueFromPipelineByPropertyName)]
|
[parameter(mandatory = $true,ValueFromPipelineByPropertyName)]
|
||||||
[int[]]$id,
|
[int[]]$id,
|
||||||
[parameter(mandatory = $true)]
|
|
||||||
[string]$URL,
|
|
||||||
[parameter(mandatory = $true)]
|
|
||||||
[string]$APIKey
|
|
||||||
|
|
||||||
|
[parameter(mandatory = $false)]
|
||||||
|
[string]$url,
|
||||||
|
|
||||||
|
[parameter(mandatory = $false)]
|
||||||
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
|
||||||
begin {
|
begin {
|
||||||
}
|
}
|
||||||
|
|
||||||
process {
|
process {
|
||||||
foreach($model_id in $id){
|
foreach($model_id in $id) {
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/models/$model_id"
|
Api = "/api/v1/models/$model_id"
|
||||||
Method = 'Delete'
|
Method = 'Delete'
|
||||||
Token = $apiKey
|
|
||||||
}
|
}
|
||||||
|
|
||||||
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
{
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
}
|
}
|
||||||
|
|
||||||
$result
|
$result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,10 @@
|
||||||
.PARAMETER ID
|
.PARAMETER ID
|
||||||
Unique ID For supplier to be removed
|
Unique ID For supplier to be removed
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
User's API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Remove-SnipeitSupplier -ID 44
|
Remove-SnipeitSupplier -ID 44
|
||||||
|
|
@ -18,8 +18,7 @@
|
||||||
Get-SnipeitSupplier | Where-object {$_.name -like '*something*'} | Remove-SnipeitSupplier
|
Get-SnipeitSupplier | Where-object {$_.name -like '*something*'} | Remove-SnipeitSupplier
|
||||||
#>
|
#>
|
||||||
|
|
||||||
function Remove-SnipeitSupplier ()
|
function Remove-SnipeitSupplier () {
|
||||||
{
|
|
||||||
[CmdletBinding(
|
[CmdletBinding(
|
||||||
SupportsShouldProcess = $true,
|
SupportsShouldProcess = $true,
|
||||||
ConfirmImpact = "Low"
|
ConfirmImpact = "Low"
|
||||||
|
|
@ -28,27 +27,46 @@ function Remove-SnipeitSupplier ()
|
||||||
Param(
|
Param(
|
||||||
[parameter(mandatory = $true,ValueFromPipelineByPropertyName)]
|
[parameter(mandatory = $true,ValueFromPipelineByPropertyName)]
|
||||||
[int[]]$id,
|
[int[]]$id,
|
||||||
[parameter(mandatory = $true)]
|
|
||||||
[string]$URL,
|
|
||||||
[parameter(mandatory = $true)]
|
|
||||||
[string]$APIKey
|
|
||||||
|
|
||||||
|
[parameter(mandatory = $false)]
|
||||||
|
[string]$url,
|
||||||
|
|
||||||
|
[parameter(mandatory = $false)]
|
||||||
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
|
||||||
begin {
|
begin {
|
||||||
}
|
}
|
||||||
|
|
||||||
process {
|
process {
|
||||||
foreach($suppliers_id in $id){
|
foreach($suppliers_id in $id) {
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/suppliers/$supplier_id"
|
Api = "/api/v1/suppliers/$supplier_id"
|
||||||
Method = 'Delete'
|
Method = 'Delete'
|
||||||
Token = $apiKey
|
|
||||||
}
|
}
|
||||||
|
|
||||||
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
{
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
}
|
}
|
||||||
|
|
||||||
$result
|
$result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,17 +7,16 @@
|
||||||
Unique ID For User to be removed
|
Unique ID For User to be removed
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
User's API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Remove-SnipeitUser -ID 44 -url $url -apiKey $secret -Verbose
|
Remove-SnipeitUser -ID 44 -url $url -apiKey $secret -Verbose
|
||||||
#>
|
#>
|
||||||
|
|
||||||
function Remove-SnipeitUser ()
|
function Remove-SnipeitUser () {
|
||||||
{
|
|
||||||
[CmdletBinding(
|
[CmdletBinding(
|
||||||
SupportsShouldProcess = $true,
|
SupportsShouldProcess = $true,
|
||||||
ConfirmImpact = "Low"
|
ConfirmImpact = "Low"
|
||||||
|
|
@ -25,13 +24,15 @@ function Remove-SnipeitUser ()
|
||||||
|
|
||||||
Param(
|
Param(
|
||||||
[parameter(mandatory = $true,ValueFromPipelineByPropertyName)]
|
[parameter(mandatory = $true,ValueFromPipelineByPropertyName)]
|
||||||
[int]$id,
|
[int[]]$id,
|
||||||
[parameter(mandatory = $true)]
|
|
||||||
[string]$URL,
|
|
||||||
[parameter(mandatory = $true)]
|
|
||||||
[string]$APIKey
|
|
||||||
|
|
||||||
|
[parameter(mandatory = $false)]
|
||||||
|
[string]$url,
|
||||||
|
|
||||||
|
[parameter(mandatory = $false)]
|
||||||
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
|
||||||
begin{
|
begin{
|
||||||
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
||||||
}
|
}
|
||||||
|
|
@ -39,17 +40,32 @@ function Remove-SnipeitUser ()
|
||||||
process {
|
process {
|
||||||
foreach($user_id in $id) {
|
foreach($user_id in $id) {
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/users/$user_id"
|
Api = "/api/v1/users/$user_id"
|
||||||
Method = 'Delete'
|
Method = 'Delete'
|
||||||
Token = $apiKey
|
|
||||||
}
|
}
|
||||||
|
|
||||||
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
{
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
}
|
}
|
||||||
|
|
||||||
$result
|
$result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,10 +10,10 @@
|
||||||
Use Get-SnipeitAccessoryOwner to find out nooded value
|
Use Get-SnipeitAccessoryOwner to find out nooded value
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
User's API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
To get the accessories_users table for specific accessory id number
|
To get the accessories_users table for specific accessory id number
|
||||||
|
|
@ -25,8 +25,7 @@
|
||||||
Get-SnipeitAccessoryOwner -assigned_pivot_id xxx
|
Get-SnipeitAccessoryOwner -assigned_pivot_id xxx
|
||||||
|
|
||||||
#>
|
#>
|
||||||
function Reset-SnipeitAccessoryOwner()
|
function Reset-SnipeitAccessoryOwner() {
|
||||||
{
|
|
||||||
[CmdletBinding(
|
[CmdletBinding(
|
||||||
SupportsShouldProcess = $true,
|
SupportsShouldProcess = $true,
|
||||||
ConfirmImpact = "Medium"
|
ConfirmImpact = "Medium"
|
||||||
|
|
@ -36,24 +35,38 @@ function Reset-SnipeitAccessoryOwner()
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $true)]
|
||||||
[int]$assigned_pivot_id,
|
[int]$assigned_pivot_id,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/accessories/$assigned_pivot_id/checkin"
|
Api = "/api/v1/accessories/$assigned_pivot_id/checkin"
|
||||||
Method = 'Post'
|
Method = 'Post'
|
||||||
Body = @{}
|
Body = @{}
|
||||||
Token = $apiKey
|
|
||||||
}
|
}
|
||||||
|
|
||||||
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
{
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
|
||||||
return $result
|
return $result
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,13 +17,11 @@
|
||||||
Notes about checkin
|
Notes about checkin
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfoeItInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
User's API Key for Snipeit, can be set using Set-SnipeitInfoeItInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Remove-SnipeitUser -ID 44 -url $url -apiKey $secret -Verbose
|
Remove-SnipeitUser -ID 44
|
||||||
#>
|
#>
|
||||||
function Reset-SnipeitAssetOwner() {
|
function Reset-SnipeitAssetOwner() {
|
||||||
[CmdletBinding(
|
[CmdletBinding(
|
||||||
|
|
@ -41,10 +39,10 @@ function Reset-SnipeitAssetOwner() {
|
||||||
|
|
||||||
[string]$notes,
|
[string]$notes,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -58,15 +56,29 @@ function Reset-SnipeitAssetOwner() {
|
||||||
if ($PSBoundParameters.ContainsKey('status_id')) { $Values.Add("status_id", $status_id) }
|
if ($PSBoundParameters.ContainsKey('status_id')) { $Values.Add("status_id", $status_id) }
|
||||||
|
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/hardware/$id/checkin"
|
Api = "/api/v1/hardware/$id/checkin"
|
||||||
Method = 'POST'
|
Method = 'POST'
|
||||||
Body = $Values
|
Body = $Values
|
||||||
Token = $apiKey
|
|
||||||
}
|
}
|
||||||
|
|
||||||
If ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
|
||||||
return $result
|
return $result
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,11 +54,10 @@ Remove current image
|
||||||
Http request type to send Snipe IT system. Defaults to Patch you could use Put if needed.
|
Http request type to send Snipe IT system. Defaults to Patch you could use Put if needed.
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfoeItInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
Users API Key for Snipeit, can be set using Set-SnipeitInfoeItInfoeItInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Set-SnipeitAccessory -id 1 -qty 3
|
Set-SnipeitAccessory -id 1 -qty 3
|
||||||
|
|
||||||
|
|
@ -107,10 +106,10 @@ function Set-SnipeitAccessory() {
|
||||||
[ValidateSet("Put","Patch")]
|
[ValidateSet("Put","Patch")]
|
||||||
[string]$RequestType = "Patch",
|
[string]$RequestType = "Patch",
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -126,20 +125,36 @@ function Set-SnipeitAccessory() {
|
||||||
}
|
}
|
||||||
|
|
||||||
process {
|
process {
|
||||||
foreach($accessory_id in $id){
|
foreach($accessory_id in $id) {
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/accessories/$accessory_id"
|
Api = "/api/v1/accessories/$accessory_id"
|
||||||
Method = $RequestType
|
Method = $RequestType
|
||||||
Body = $Values
|
Body = $Values
|
||||||
Token = $apiKey
|
|
||||||
}
|
}
|
||||||
|
|
||||||
If ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
}
|
}
|
||||||
|
|
||||||
$result
|
$result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,16 +14,15 @@
|
||||||
Notes about checkout
|
Notes about checkout
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
User's API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Set-SnipeitAccessoryOwner -id 1 -assigned_id 1 -note "testing check out to user"
|
Set-SnipeitAccessoryOwner -id 1 -assigned_id 1 -note "testing check out to user"
|
||||||
#>
|
#>
|
||||||
function Set-SnipeitAccessoryOwner()
|
function Set-SnipeitAccessoryOwner() {
|
||||||
{
|
|
||||||
[CmdletBinding(
|
[CmdletBinding(
|
||||||
SupportsShouldProcess = $true,
|
SupportsShouldProcess = $true,
|
||||||
ConfirmImpact = "Medium"
|
ConfirmImpact = "Medium"
|
||||||
|
|
@ -38,10 +37,10 @@ function Set-SnipeitAccessoryOwner()
|
||||||
|
|
||||||
[string] $note,
|
[string] $note,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
begin{
|
begin{
|
||||||
|
|
@ -49,20 +48,35 @@ function Set-SnipeitAccessoryOwner()
|
||||||
}
|
}
|
||||||
|
|
||||||
process {
|
process {
|
||||||
foreach($accessory_id in $id){
|
foreach($accessory_id in $id) {
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/accessories/$accessory_id/checkout"
|
Api = "/api/v1/accessories/$accessory_id/checkout"
|
||||||
Method = 'POST'
|
Method = 'POST'
|
||||||
Body = $Values
|
Body = $Values
|
||||||
Token = $apiKey
|
|
||||||
}
|
}
|
||||||
|
|
||||||
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
{
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result
|
return $result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -63,10 +63,10 @@
|
||||||
Http request type to send Snipe IT system. Defaults to Patch you could use Put if needed.
|
Http request type to send Snipe IT system. Defaults to Patch you could use Put if needed.
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfoeItInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
Users API Key for Snipeit, can be set using Set-SnipeitInfoeItInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
|
||||||
|
|
||||||
.PARAMETER customfields
|
.PARAMETER customfields
|
||||||
Hastable of custom fields and extra fields that need passing through to Snipeit
|
Hastable of custom fields and extra fields that need passing through to Snipeit
|
||||||
|
|
@ -81,8 +81,7 @@
|
||||||
Get-SnipeitAsset -serial 12345678 | Set-SnipeitAsset -notes 'Just updated'
|
Get-SnipeitAsset -serial 12345678 | Set-SnipeitAsset -notes 'Just updated'
|
||||||
#>
|
#>
|
||||||
|
|
||||||
function Set-SnipeitAsset()
|
function Set-SnipeitAsset() {
|
||||||
{
|
|
||||||
[CmdletBinding(
|
[CmdletBinding(
|
||||||
SupportsShouldProcess = $true,
|
SupportsShouldProcess = $true,
|
||||||
ConfirmImpact = "Medium"
|
ConfirmImpact = "Medium"
|
||||||
|
|
@ -133,10 +132,10 @@ function Set-SnipeitAsset()
|
||||||
|
|
||||||
[switch]$image_delete=$false,
|
[switch]$image_delete=$false,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$apiKey,
|
[string]$apiKey,
|
||||||
|
|
||||||
[Alias('CustomValues')]
|
[Alias('CustomValues')]
|
||||||
|
|
@ -151,28 +150,42 @@ function Set-SnipeitAsset()
|
||||||
$Values['purchase_date'] = $Values['purchase_date'].ToString("yyyy-MM-dd")
|
$Values['purchase_date'] = $Values['purchase_date'].ToString("yyyy-MM-dd")
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($customfields)
|
if ($customfields) {
|
||||||
{
|
|
||||||
$Values += $customfields
|
$Values += $customfields
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
process {
|
process {
|
||||||
foreach($asset_id in $id){
|
foreach($asset_id in $id) {
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/hardware/$asset_id"
|
Api = "/api/v1/hardware/$asset_id"
|
||||||
Method = $RequestType
|
Method = $RequestType
|
||||||
Body = $Values
|
Body = $Values
|
||||||
Token = $apiKey
|
|
||||||
}
|
}
|
||||||
|
|
||||||
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
{
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
}
|
}
|
||||||
|
|
||||||
$result
|
$result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,16 +28,15 @@
|
||||||
Optional date to override the checkout time of now
|
Optional date to override the checkout time of now
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
User's API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Set-SnipeitAssetOwner -id 1 -assigned_id 1 -checkout_to_type user -note "testing check out to user"
|
Set-SnipeitAssetOwner -id 1 -assigned_id 1 -checkout_to_type user -note "testing check out to user"
|
||||||
#>
|
#>
|
||||||
function Set-SnipeitAssetOwner()
|
function Set-SnipeitAssetOwner() {
|
||||||
{
|
|
||||||
[CmdletBinding(
|
[CmdletBinding(
|
||||||
SupportsShouldProcess = $true,
|
SupportsShouldProcess = $true,
|
||||||
ConfirmImpact = "Medium"
|
ConfirmImpact = "Medium"
|
||||||
|
|
@ -61,10 +60,10 @@ function Set-SnipeitAssetOwner()
|
||||||
|
|
||||||
[datetime]$checkout_at,
|
[datetime]$checkout_at,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -81,33 +80,47 @@ function Set-SnipeitAssetOwner()
|
||||||
$Values['checkout_at'] = $Values['checkout_at'].ToString("yyyy-MM-dd")
|
$Values['checkout_at'] = $Values['checkout_at'].ToString("yyyy-MM-dd")
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($checkout_to_type)
|
switch ($checkout_to_type) {
|
||||||
{
|
|
||||||
'location' { $Values += @{ "assigned_location" = $assigned_id } }
|
'location' { $Values += @{ "assigned_location" = $assigned_id } }
|
||||||
'user' { $Values += @{ "assigned_user" = $assigned_id } }
|
'user' { $Values += @{ "assigned_user" = $assigned_id } }
|
||||||
'asset' { $Values += @{ "assigned_asset" = $assigned_id } }
|
'asset' { $Values += @{ "assigned_asset" = $assigned_id } }
|
||||||
}
|
}
|
||||||
|
|
||||||
#This can be removed now
|
#This can be removed now
|
||||||
if($Values.ContainsKey('assigned_id')){$Values.Remove('assigned_id')}
|
if ($Values.ContainsKey('assigned_id')) {$Values.Remove('assigned_id')}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
process{
|
process{
|
||||||
foreach($asset_id in $id){
|
foreach($asset_id in $id) {
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/hardware/$asset_id/checkout"
|
Api = "/api/v1/hardware/$asset_id/checkout"
|
||||||
Method = 'POST'
|
Method = 'POST'
|
||||||
Body = $Values
|
Body = $Values
|
||||||
Token = $apiKey
|
|
||||||
}
|
}
|
||||||
|
|
||||||
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
{
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result
|
return $result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,17 +30,16 @@ Remove current image
|
||||||
Http request type to send Snipe IT system. Defaults to Patch you could use Put if needed.
|
Http request type to send Snipe IT system. Defaults to Patch you could use Put if needed.
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
User's API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Set-SnipeitCategory -id 4 -name "Laptops"
|
Set-SnipeitCategory -id 4 -name "Laptops"
|
||||||
#>
|
#>
|
||||||
|
|
||||||
function Set-SnipeitCategory()
|
function Set-SnipeitCategory() {
|
||||||
{
|
|
||||||
[CmdletBinding(
|
[CmdletBinding(
|
||||||
SupportsShouldProcess = $true,
|
SupportsShouldProcess = $true,
|
||||||
ConfirmImpact = "Low"
|
ConfirmImpact = "Low"
|
||||||
|
|
@ -71,10 +70,10 @@ function Set-SnipeitCategory()
|
||||||
[ValidateSet("Put","Patch")]
|
[ValidateSet("Put","Patch")]
|
||||||
[string]$RequestType = "Patch",
|
[string]$RequestType = "Patch",
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
@ -86,20 +85,35 @@ function Set-SnipeitCategory()
|
||||||
}
|
}
|
||||||
|
|
||||||
process {
|
process {
|
||||||
foreach($category_id in $id){
|
foreach($category_id in $id) {
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/categories/$category_id"
|
Api = "/api/v1/categories/$category_id"
|
||||||
Method = $RequestType
|
Method = $RequestType
|
||||||
Body = $values
|
Body = $values
|
||||||
Token = $apiKey
|
|
||||||
}
|
}
|
||||||
|
|
||||||
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
{
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
}
|
}
|
||||||
|
|
||||||
$result
|
$result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,10 +21,10 @@ Remove current image
|
||||||
Http request type to send Snipe IT system. Defaults to Patch you could use Put if needed.
|
Http request type to send Snipe IT system. Defaults to Patch you could use Put if needed.
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
User's API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
An example
|
An example
|
||||||
|
|
@ -32,8 +32,7 @@ An example
|
||||||
.NOTES
|
.NOTES
|
||||||
General notes
|
General notes
|
||||||
#>
|
#>
|
||||||
function Set-SnipeitCompany()
|
function Set-SnipeitCompany() {
|
||||||
{
|
|
||||||
[CmdletBinding(
|
[CmdletBinding(
|
||||||
SupportsShouldProcess = $true,
|
SupportsShouldProcess = $true,
|
||||||
ConfirmImpact = "Medium"
|
ConfirmImpact = "Medium"
|
||||||
|
|
@ -54,10 +53,10 @@ function Set-SnipeitCompany()
|
||||||
[ValidateSet("Put","Patch")]
|
[ValidateSet("Put","Patch")]
|
||||||
[string]$RequestType = "Patch",
|
[string]$RequestType = "Patch",
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -66,20 +65,34 @@ function Set-SnipeitCompany()
|
||||||
}
|
}
|
||||||
|
|
||||||
process{
|
process{
|
||||||
foreach($company_id in $id){
|
foreach($company_id in $id) {
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/companies/$company_id"
|
Api = "/api/v1/companies/$company_id"
|
||||||
Method = $RequestType
|
Method = $RequestType
|
||||||
Body = $Values
|
Body = $Values
|
||||||
Token = $apiKey
|
|
||||||
}
|
}
|
||||||
|
|
||||||
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
{
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
}
|
}
|
||||||
|
|
||||||
$result
|
$result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,19 +42,17 @@ Remove current image
|
||||||
Http request type to send Snipe IT system. Defaults to Patch you could use Put if needed.
|
Http request type to send Snipe IT system. Defaults to Patch you could use Put if needed.
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
User's API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
An example
|
Set-SnipeitComponent -id 42 -qty 12
|
||||||
|
Sets count of component with ID 42 to 12
|
||||||
|
|
||||||
.NOTES
|
|
||||||
General notes
|
|
||||||
#>
|
#>
|
||||||
function Set-SnipeitComponent()
|
function Set-SnipeitComponent() {
|
||||||
{
|
|
||||||
[CmdletBinding(
|
[CmdletBinding(
|
||||||
SupportsShouldProcess = $true,
|
SupportsShouldProcess = $true,
|
||||||
ConfirmImpact = "Medium"
|
ConfirmImpact = "Medium"
|
||||||
|
|
@ -90,10 +88,10 @@ function Set-SnipeitComponent()
|
||||||
[ValidateSet("Put","Patch")]
|
[ValidateSet("Put","Patch")]
|
||||||
[string]$RequestType = "Patch",
|
[string]$RequestType = "Patch",
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
begin {
|
begin {
|
||||||
|
|
@ -107,20 +105,35 @@ function Set-SnipeitComponent()
|
||||||
}
|
}
|
||||||
|
|
||||||
process {
|
process {
|
||||||
foreach($component_id in $id){
|
foreach($component_id in $id) {
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/components/$component_id"
|
Api = "/api/v1/components/$component_id"
|
||||||
Method = $RequestType
|
Method = $RequestType
|
||||||
Body = $Values
|
Body = $Values
|
||||||
Token = $apiKey
|
|
||||||
}
|
}
|
||||||
|
|
||||||
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
{
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
}
|
}
|
||||||
|
|
||||||
$result
|
$result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -57,10 +57,10 @@ Remove current image
|
||||||
Http request type to send Snipe IT system. Defaults to Patch you could use Put if needed.
|
Http request type to send Snipe IT system. Defaults to Patch you could use Put if needed.
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
|
||||||
|
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
|
|
@ -69,8 +69,7 @@ Create consumable with stock count 20 , alert when stock is 5 or lower
|
||||||
|
|
||||||
#>
|
#>
|
||||||
|
|
||||||
function Set-SnipeitConsumable()
|
function Set-SnipeitConsumable() {
|
||||||
{
|
|
||||||
[CmdletBinding(
|
[CmdletBinding(
|
||||||
SupportsShouldProcess = $true,
|
SupportsShouldProcess = $true,
|
||||||
ConfirmImpact = "Low"
|
ConfirmImpact = "Low"
|
||||||
|
|
@ -129,10 +128,10 @@ function Set-SnipeitConsumable()
|
||||||
[ValidateSet("Put","Patch")]
|
[ValidateSet("Put","Patch")]
|
||||||
[string]$RequestType = "Patch",
|
[string]$RequestType = "Patch",
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
@ -146,20 +145,35 @@ function Set-SnipeitConsumable()
|
||||||
}
|
}
|
||||||
|
|
||||||
process {
|
process {
|
||||||
foreach($consumable_id in $id ){
|
foreach($consumable_id in $id ) {
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/consumables/$consumable_id"
|
Api = "/api/v1/consumables/$consumable_id"
|
||||||
Method = $RequestType
|
Method = $RequestType
|
||||||
Body = $Values
|
Body = $Values
|
||||||
Token = $apiKey
|
|
||||||
}
|
}
|
||||||
|
|
||||||
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
{
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
}
|
}
|
||||||
|
|
||||||
$result
|
$result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,17 +33,16 @@
|
||||||
Http request type to send Snipe IT system. Defaults to Put you could use Patch if needed.
|
Http request type to send Snipe IT system. Defaults to Put you could use Patch if needed.
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
New-SnipeitCustomField -Name "AntivirusInstalled" -Format "BOOLEAN" -HelpText "Is AntiVirus installed on Asset"
|
New-SnipeitCustomField -Name "AntivirusInstalled" -Format "BOOLEAN" -HelpText "Is AntiVirus installed on Asset"
|
||||||
#>
|
#>
|
||||||
|
|
||||||
function Set-SnipeitCustomField()
|
function Set-SnipeitCustomField() {
|
||||||
{
|
|
||||||
[CmdletBinding(
|
[CmdletBinding(
|
||||||
SupportsShouldProcess = $true,
|
SupportsShouldProcess = $true,
|
||||||
ConfirmImpact = "Low"
|
ConfirmImpact = "Low"
|
||||||
|
|
@ -75,10 +74,10 @@ function Set-SnipeitCustomField()
|
||||||
[ValidateSet("Put","Patch")]
|
[ValidateSet("Put","Patch")]
|
||||||
[string]$RequestType = "Put",
|
[string]$RequestType = "Put",
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
begin {
|
begin {
|
||||||
|
|
@ -93,19 +92,33 @@ function Set-SnipeitCustomField()
|
||||||
process{
|
process{
|
||||||
foreach($field_id in $id) {
|
foreach($field_id in $id) {
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/fields/$field_id"
|
Api = "/api/v1/fields/$field_id"
|
||||||
Method = $RequestType
|
Method = $RequestType
|
||||||
Body = $Values
|
Body = $Values
|
||||||
Token = $apiKey
|
|
||||||
}
|
}
|
||||||
|
|
||||||
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
{
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
}
|
}
|
||||||
|
|
||||||
$result
|
$result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,10 +30,10 @@
|
||||||
Http request type to send Snipe IT system. Defaults to Patch you could use Put if needed.
|
Http request type to send Snipe IT system. Defaults to Patch you could use Put if needed.
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Set-SnipeitDepartment -id 4 -manager_id 3
|
Set-SnipeitDepartment -id 4 -manager_id 3
|
||||||
|
|
@ -68,10 +68,10 @@ function Set-SnipeitDepartment() {
|
||||||
[ValidateSet("Put","Patch")]
|
[ValidateSet("Put","Patch")]
|
||||||
[string]$RequestType = "Patch",
|
[string]$RequestType = "Patch",
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -83,18 +83,33 @@ function Set-SnipeitDepartment() {
|
||||||
process {
|
process {
|
||||||
foreach ($department_id in $id) {
|
foreach ($department_id in $id) {
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/departments/$department_id"
|
Api = "/api/v1/departments/$department_id"
|
||||||
Method = $RequestType
|
Method = $RequestType
|
||||||
Body = $Values
|
Body = $Values
|
||||||
Token = $apiKey
|
|
||||||
}
|
}
|
||||||
|
|
||||||
If ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
}
|
}
|
||||||
|
|
||||||
$result
|
$result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,16 @@
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Sets authetication information
|
Sets authetication information. Deprecated, use Connect-SnipeitPS instead.
|
||||||
|
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
Set apikey and url user to connect Snipe-It system
|
Deprecated combatibilty function that Set apikey and url user to connect Snipe-It system.
|
||||||
|
Please use Connect-SnipeitPS instead.
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
User's API Key for Snipeit, can be set using Set-SnipeitInfo command
|
User's API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Set-SnipeitInfo -url $url -apiKey -Verbose
|
Set-SnipeitInfo -url $url -apiKey -Verbose
|
||||||
|
|
@ -17,50 +19,18 @@ function Set-SnipeitInfo {
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
[System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseShouldProcessForStateChangingFunctions', '')]
|
[System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseShouldProcessForStateChangingFunctions', '')]
|
||||||
param (
|
param (
|
||||||
|
[parameter(Mandatory=$true)]
|
||||||
[Uri]$url,
|
[Uri]$url,
|
||||||
|
[parameter(Mandatory=$true)]
|
||||||
[String]$apiKey
|
[String]$apiKey
|
||||||
)
|
)
|
||||||
|
|
||||||
BEGIN {
|
BEGIN {
|
||||||
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
|
||||||
function Add-DefaultParameter {
|
|
||||||
param(
|
|
||||||
[Parameter(Mandatory = $true)]
|
|
||||||
[string]$Command,
|
|
||||||
|
|
||||||
[Parameter(Mandatory = $true)]
|
Write-Warning "Deprecated $($MyInvocation.InvocationName) is still working, please use Connect-SnipeitPS instead."
|
||||||
[string]$Parameter,
|
|
||||||
|
|
||||||
[Parameter(Mandatory = $true)]
|
|
||||||
$Value
|
|
||||||
)
|
|
||||||
|
|
||||||
PROCESS {
|
|
||||||
#Write-Verbose "[$($MyInvocation.MyCommand.Name)] Setting [$command : $parameter] = $value"
|
|
||||||
|
|
||||||
# Needs to set both global and module scope for the private functions:
|
|
||||||
# http://stackoverflow.com/questions/30427110/set-psdefaultparametersvalues-for-use-within-module-scope
|
|
||||||
$PSDefaultParameterValues["${command}:${parameter}"] = $Value
|
|
||||||
$global:PSDefaultParameterValues["${command}:${parameter}"] = $Value
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$moduleCommands = Get-Command -Module SnipeitPS -CommandType Function
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PROCESS {
|
PROCESS {
|
||||||
foreach ($command in $moduleCommands) {
|
Connect-SnipeitPS -Url $url -apiKey $apiKey
|
||||||
$parameter = "url"
|
|
||||||
if ($url -and ($command.Parameters.Keys -contains $parameter)) {
|
|
||||||
Add-DefaultParameter -Command $command -Parameter $parameter -Value ($url.AbsoluteUri.TrimEnd('/'))
|
|
||||||
}
|
|
||||||
|
|
||||||
$parameter = "apiKey"
|
|
||||||
if ($apiKey -and ($command.Parameters.Keys -contains $parameter)) {
|
|
||||||
Add-DefaultParameter -Command $command -Parameter $parameter -Value $apiKey
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -63,10 +63,10 @@
|
||||||
Http request type to send Snipe IT system. Defaults to Patch you could use Put if needed.
|
Http request type to send Snipe IT system. Defaults to Patch you could use Put if needed.
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Set-SnipeitLicence -name "License" -seats 3 -company_id 1
|
Set-SnipeitLicence -name "License" -seats 3 -company_id 1
|
||||||
|
|
@ -127,10 +127,10 @@ function Set-SnipeitLicense() {
|
||||||
[ValidateSet("Put","Patch")]
|
[ValidateSet("Put","Patch")]
|
||||||
[string]$RequestType = "Patch",
|
[string]$RequestType = "Patch",
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -154,19 +154,34 @@ function Set-SnipeitLicense() {
|
||||||
}
|
}
|
||||||
|
|
||||||
process {
|
process {
|
||||||
foreach($license_id in $id){
|
foreach($license_id in $id) {
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/licenses/$license_id"
|
Api = "/api/v1/licenses/$license_id"
|
||||||
Method = $RequestType
|
Method = $RequestType
|
||||||
Body = $Values
|
Body = $Values
|
||||||
Token = $apiKey
|
|
||||||
}
|
}
|
||||||
|
|
||||||
If ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
}
|
}
|
||||||
|
|
||||||
$result
|
$result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,10 +20,10 @@
|
||||||
Http request type to send Snipe IT system. Defaults to Patch you could use Put if needed.
|
Http request type to send Snipe IT system. Defaults to Patch you could use Put if needed.
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
User's API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Set-SnipeitLicenceSeat -ID 1 -seat_id 1 -assigned_id 3
|
Set-SnipeitLicenceSeat -ID 1 -seat_id 1 -assigned_id 3
|
||||||
|
|
@ -38,8 +38,7 @@
|
||||||
Checkin licence seat id 1 of licence id 1
|
Checkin licence seat id 1 of licence id 1
|
||||||
|
|
||||||
#>
|
#>
|
||||||
function Set-SnipeitLicenseSeat()
|
function Set-SnipeitLicenseSeat() {
|
||||||
{
|
|
||||||
[CmdletBinding(
|
[CmdletBinding(
|
||||||
SupportsShouldProcess = $true,
|
SupportsShouldProcess = $true,
|
||||||
ConfirmImpact = "Medium"
|
ConfirmImpact = "Medium"
|
||||||
|
|
@ -64,10 +63,10 @@ function Set-SnipeitLicenseSeat()
|
||||||
[ValidateSet("Put","Patch")]
|
[ValidateSet("Put","Patch")]
|
||||||
[string]$RequestType = "Patch",
|
[string]$RequestType = "Patch",
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -78,18 +77,33 @@ function Set-SnipeitLicenseSeat()
|
||||||
process{
|
process{
|
||||||
foreach($license_id in $id) {
|
foreach($license_id in $id) {
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/licenses/$license_id/seats/$seat_id"
|
Api = "/api/v1/licenses/$license_id/seats/$seat_id"
|
||||||
Method = $RequestType
|
Method = $RequestType
|
||||||
Body = $Values
|
Body = $Values
|
||||||
Token = $apiKey
|
|
||||||
}
|
}
|
||||||
|
|
||||||
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
{
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result
|
return $result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,10 +54,10 @@
|
||||||
Http request type to send Snipe IT system. Defaults to Patch you could use Put if needed.
|
Http request type to send Snipe IT system. Defaults to Patch you could use Put if needed.
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Set-SnipeitLocation -id 123 -name "Some storage" -parent_id 100
|
Set-SnipeitLocation -id 123 -name "Some storage" -parent_id 100
|
||||||
|
|
@ -105,10 +105,10 @@ function Set-SnipeitLocation() {
|
||||||
[ValidateSet("Put","Patch")]
|
[ValidateSet("Put","Patch")]
|
||||||
[string]$RequestType = "Patch",
|
[string]$RequestType = "Patch",
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -121,18 +121,34 @@ function Set-SnipeitLocation() {
|
||||||
process{
|
process{
|
||||||
foreach ($location_id in $id) {
|
foreach ($location_id in $id) {
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/locations/$location_id"
|
Api = "/api/v1/locations/$location_id"
|
||||||
Method = $RequestType
|
Method = $RequestType
|
||||||
Body = $Values
|
Body = $Values
|
||||||
Token = $apiKey
|
|
||||||
}
|
}
|
||||||
|
|
||||||
If ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
}
|
}
|
||||||
|
|
||||||
$result
|
$result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,17 +18,16 @@
|
||||||
Http request type to send Snipe IT system. Defaults to Patch you could use Put if needed.
|
Http request type to send Snipe IT system. Defaults to Patch you could use Put if needed.
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
New-SnipeitManufacturer -name "HP"
|
New-SnipeitManufacturer -name "HP"
|
||||||
#>
|
#>
|
||||||
|
|
||||||
function Set-SnipeitManufacturer()
|
function Set-SnipeitManufacturer() {
|
||||||
{
|
|
||||||
[CmdletBinding(
|
[CmdletBinding(
|
||||||
SupportsShouldProcess = $true,
|
SupportsShouldProcess = $true,
|
||||||
ConfirmImpact = "Low"
|
ConfirmImpact = "Low"
|
||||||
|
|
@ -46,10 +45,10 @@ function Set-SnipeitManufacturer()
|
||||||
[ValidateSet("Put","Patch")]
|
[ValidateSet("Put","Patch")]
|
||||||
[string]$RequestType = "Patch",
|
[string]$RequestType = "Patch",
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -62,17 +61,33 @@ function Set-SnipeitManufacturer()
|
||||||
process{
|
process{
|
||||||
foreach ($manufacturer_id in $id) {
|
foreach ($manufacturer_id in $id) {
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/manufacturers/$manufacturer_id"
|
Api = "/api/v1/manufacturers/$manufacturer_id"
|
||||||
Method = $RequestType
|
Method = $RequestType
|
||||||
Body = $Values
|
Body = $Values
|
||||||
Token = $apiKey
|
|
||||||
}
|
}
|
||||||
|
|
||||||
If ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
}
|
}
|
||||||
|
|
||||||
$result
|
$result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,10 +33,10 @@
|
||||||
Http request type to send Snipe IT system. Defaults to Patch you could use Put if needed.
|
Http request type to send Snipe IT system. Defaults to Patch you could use Put if needed.
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
New-SnipeitModel -name "DL380" -manufacturer_id 2 -fieldset_id 2 -category_id 1
|
New-SnipeitModel -name "DL380" -manufacturer_id 2 -fieldset_id 2 -category_id 1
|
||||||
|
|
@ -74,10 +74,10 @@ function Set-SnipeitModel() {
|
||||||
[ValidateSet("Put","Patch")]
|
[ValidateSet("Put","Patch")]
|
||||||
[string]$RequestType = "Patch",
|
[string]$RequestType = "Patch",
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -90,17 +90,33 @@ function Set-SnipeitModel() {
|
||||||
process {
|
process {
|
||||||
foreach ($model_id in $id) {
|
foreach ($model_id in $id) {
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/models/$model_id"
|
Api = "/api/v1/models/$model_id"
|
||||||
Method = $RequestType
|
Method = $RequestType
|
||||||
Body = $Values
|
Body = $Values
|
||||||
Token = $apiKey
|
|
||||||
}
|
}
|
||||||
|
|
||||||
If ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
}
|
}
|
||||||
|
|
||||||
$result
|
$result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,10 +19,10 @@ Hex code showing what color the status label should be on the pie chart in the d
|
||||||
Http request type to send Snipe IT system. Defaults to Patch you could use Put if needed.
|
Http request type to send Snipe IT system. Defaults to Patch you could use Put if needed.
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Get-SnipeitStatus -search "Ready to Deploy"
|
Get-SnipeitStatus -search "Ready to Deploy"
|
||||||
|
|
@ -32,8 +32,7 @@ Set-SnipeitStatus -id 3 -name 'Waiting for arrival' -type pending
|
||||||
|
|
||||||
#>
|
#>
|
||||||
|
|
||||||
function Set-SnipeitStatus()
|
function Set-SnipeitStatus() {
|
||||||
{
|
|
||||||
[CmdletBinding(
|
[CmdletBinding(
|
||||||
SupportsShouldProcess = $true,
|
SupportsShouldProcess = $true,
|
||||||
ConfirmImpact = "Medium"
|
ConfirmImpact = "Medium"
|
||||||
|
|
@ -59,10 +58,10 @@ function Set-SnipeitStatus()
|
||||||
[ValidateSet("Put","Patch")]
|
[ValidateSet("Put","Patch")]
|
||||||
[string]$RequestType = "Patch",
|
[string]$RequestType = "Patch",
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -73,16 +72,32 @@ function Set-SnipeitStatus()
|
||||||
process {
|
process {
|
||||||
foreach($status_id in $id) {
|
foreach($status_id in $id) {
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/statuslabels/$status_id"
|
Api = "/api/v1/statuslabels/$status_id"
|
||||||
Method = $RequestType
|
Method = $RequestType
|
||||||
Body = $Values
|
Body = $Values
|
||||||
Token = $apiKey
|
|
||||||
}
|
}
|
||||||
|
|
||||||
If ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
}
|
}
|
||||||
$result
|
$result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -51,10 +51,10 @@
|
||||||
Http request type to send Snipe IT system. Defaults to Patch you could use Put if needed.
|
Http request type to send Snipe IT system. Defaults to Patch you could use Put if needed.
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
New-SnipeitDepartment -name "Department1" -company_id 1 -localtion_id 1 -manager_id 3
|
New-SnipeitDepartment -name "Department1" -company_id 1 -localtion_id 1 -manager_id 3
|
||||||
|
|
@ -101,10 +101,10 @@ function Set-SnipeitSupplier() {
|
||||||
[ValidateSet("Put","Patch")]
|
[ValidateSet("Put","Patch")]
|
||||||
[string]$RequestType = "Patch",
|
[string]$RequestType = "Patch",
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -117,18 +117,34 @@ function Set-SnipeitSupplier() {
|
||||||
process {
|
process {
|
||||||
foreach ($supplier_id in $id) {
|
foreach ($supplier_id in $id) {
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/suppliers/$supplier_id"
|
Api = "/api/v1/suppliers/$supplier_id"
|
||||||
Method = $RequestType
|
Method = $RequestType
|
||||||
Body = $Values
|
Body = $Values
|
||||||
Token = $apiKey
|
|
||||||
}
|
}
|
||||||
|
|
||||||
If ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
}
|
}
|
||||||
|
|
||||||
$result
|
$result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -63,10 +63,10 @@
|
||||||
Http request type to send Snipe IT system. Defaults to Patch you could use Put if needed.
|
Http request type to send Snipe IT system. Defaults to Patch you could use Put if needed.
|
||||||
|
|
||||||
.PARAMETER url
|
.PARAMETER url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
||||||
|
|
||||||
.PARAMETER apiKey
|
.PARAMETER apiKey
|
||||||
User's API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Update-SnipeitUser -id 3 -fist_name It -lastname Snipe -username snipeit -activated $false -company_id 1 -location_id 1 -department_id 1
|
Update-SnipeitUser -id 3 -fist_name It -lastname Snipe -username snipeit -activated $false -company_id 1 -location_id 1 -department_id 1
|
||||||
|
|
@ -124,10 +124,10 @@ function Set-SnipeitUser() {
|
||||||
[ValidateSet("Put","Patch")]
|
[ValidateSet("Put","Patch")]
|
||||||
[string]$RequestType = "Patch",
|
[string]$RequestType = "Patch",
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $false)]
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
begin{
|
begin{
|
||||||
|
|
@ -144,17 +144,33 @@ function Set-SnipeitUser() {
|
||||||
process{
|
process{
|
||||||
foreach($user_id in $id) {
|
foreach($user_id in $id) {
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/users/$user_id"
|
Api = "/api/v1/users/$user_id"
|
||||||
Method = 'PATCH'
|
Method = 'PATCH'
|
||||||
Body = $Values
|
Body = $Values
|
||||||
Token = $apiKey
|
|
||||||
}
|
}
|
||||||
|
|
||||||
If ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('url')) {
|
||||||
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
||||||
|
Set-SnipeitPSLegacyUrl -url $url
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
||||||
$result = Invoke-SnipeitMethod @Parameters
|
$result = Invoke-SnipeitMethod @Parameters
|
||||||
}
|
}
|
||||||
|
|
||||||
$result
|
$result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
end {
|
||||||
|
# reset legacy sessions
|
||||||
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
||||||
|
Reset-SnipeitPSLegacyApi
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,7 @@ Replaces old command from file "your-script.ps1" and creates new script "new-scr
|
||||||
After testing new file you can replace old file with new.
|
After testing new file you can replace old file with new.
|
||||||
|
|
||||||
#>
|
#>
|
||||||
function Update-SnipeitAlias()
|
function Update-SnipeitAlias() {
|
||||||
{
|
|
||||||
[CmdletBinding(
|
[CmdletBinding(
|
||||||
SupportsShouldProcess = $true,
|
SupportsShouldProcess = $true,
|
||||||
ConfirmImpact = "Low"
|
ConfirmImpact = "Low"
|
||||||
|
|
@ -34,8 +33,8 @@ function Update-SnipeitAlias()
|
||||||
|
|
||||||
}
|
}
|
||||||
process {
|
process {
|
||||||
If ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
||||||
ForEach ($st in $String){
|
ForEach ($st in $String) {
|
||||||
$result = $st
|
$result = $st
|
||||||
ForEach ($key in $SnipeitAliases.Keys ) {
|
ForEach ($key in $SnipeitAliases.Keys ) {
|
||||||
#Write-Verbose "Replacing $key with $($SnipeitAliases[$key])"
|
#Write-Verbose "Replacing $key with $($SnipeitAliases[$key])"
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
RootModule = 'SnipeitPS'
|
RootModule = 'SnipeitPS'
|
||||||
|
|
||||||
# Version number of this module.
|
# Version number of this module.
|
||||||
ModuleVersion = '1.9'
|
ModuleVersion = '1.10'
|
||||||
|
|
||||||
# Supported PSEditions
|
# Supported PSEditions
|
||||||
# CompatiblePSEditions = @()
|
# CompatiblePSEditions = @()
|
||||||
|
|
@ -70,6 +70,7 @@ PowerShellVersion = '5.1'
|
||||||
|
|
||||||
# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
|
# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
|
||||||
FunctionsToExport = @(
|
FunctionsToExport = @(
|
||||||
|
'Connect-SnipeitPS',
|
||||||
'Get-SnipeitAccessory',
|
'Get-SnipeitAccessory',
|
||||||
'Get-SnipeitAccessoryOwner',
|
'Get-SnipeitAccessoryOwner',
|
||||||
'Get-SnipeitActivity',
|
'Get-SnipeitActivity',
|
||||||
|
|
|
||||||
|
|
@ -5,14 +5,22 @@ Powershell API for Snipeit Asset Management
|
||||||
$scriptRoot = $PSScriptRoot + '\Public'
|
$scriptRoot = $PSScriptRoot + '\Public'
|
||||||
|
|
||||||
Get-ChildItem $scriptRoot *.ps1 | ForEach-Object {
|
Get-ChildItem $scriptRoot *.ps1 | ForEach-Object {
|
||||||
Import-Module $_.FullName
|
. $_.FullName
|
||||||
}
|
}
|
||||||
|
|
||||||
$scriptRoot = $PSScriptRoot + '\Private'
|
$scriptRoot = $PSScriptRoot + '\Private'
|
||||||
|
|
||||||
Get-ChildItem $scriptRoot *.ps1 | ForEach-Object {
|
Get-ChildItem $scriptRoot *.ps1 | ForEach-Object {
|
||||||
Import-Module $_.FullName
|
. $_.FullName
|
||||||
}
|
}
|
||||||
|
|
||||||
#Create unprefixed aliases
|
#Create unprefixed aliases
|
||||||
Set-SnipeitAlias
|
Set-SnipeitAlias
|
||||||
|
|
||||||
|
#Session variable for storing current session information
|
||||||
|
$SnipeitPSSession = [ordered]@{
|
||||||
|
'url' = $null
|
||||||
|
'apiKey' = $null
|
||||||
|
}
|
||||||
|
New-Variable -Name SnipeitPSSession -Value $SnipeitPSSession -Scope Script -Force
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ environment:
|
||||||
secure: UdM6qhf5B0G8liHhUrwWERCZr44iSqmg4jUq0lwlTjZs4KyeoiwnBzdej0phqIAm
|
secure: UdM6qhf5B0G8liHhUrwWERCZr44iSqmg4jUq0lwlTjZs4KyeoiwnBzdej0phqIAm
|
||||||
PShell: '5'
|
PShell: '5'
|
||||||
|
|
||||||
version: 1.9.{build}
|
version: 1.10.{build}
|
||||||
|
|
||||||
# Don't rebuild when I tag a release on GitHub
|
# Don't rebuild when I tag a release on GitHub
|
||||||
skip_tags: true
|
skip_tags: true
|
||||||
|
|
|
||||||
137
docs/Connect-SnipeitPS.md
Normal file
137
docs/Connect-SnipeitPS.md
Normal file
|
|
@ -0,0 +1,137 @@
|
||||||
|
---
|
||||||
|
external help file: SnipeitPS-help.xml
|
||||||
|
Module Name: snipeitps
|
||||||
|
online version:
|
||||||
|
schema: 2.0.0
|
||||||
|
---
|
||||||
|
|
||||||
|
# Connect-SnipeitPS
|
||||||
|
|
||||||
|
## SYNOPSIS
|
||||||
|
Sets authetication information
|
||||||
|
|
||||||
|
## SYNTAX
|
||||||
|
|
||||||
|
### Connect with url and apikey (Default)
|
||||||
|
```
|
||||||
|
Connect-SnipeitPS -url <Uri> -apiKey <String> [<CommonParameters>]
|
||||||
|
```
|
||||||
|
|
||||||
|
### Connect with url and secure apikey
|
||||||
|
```
|
||||||
|
Connect-SnipeitPS -url <Uri> -secureApiKey <SecureString> [<CommonParameters>]
|
||||||
|
```
|
||||||
|
|
||||||
|
### Connect with credential
|
||||||
|
```
|
||||||
|
Connect-SnipeitPS -siteCred <PSCredential> [<CommonParameters>]
|
||||||
|
```
|
||||||
|
|
||||||
|
## DESCRIPTION
|
||||||
|
Sets apikey and url to connect Snipe-It system.
|
||||||
|
Based on Set-SnipeitInfo command, what is now just combatipility wrapper
|
||||||
|
and calls Connect-SnipeitPS
|
||||||
|
|
||||||
|
## EXAMPLES
|
||||||
|
|
||||||
|
### EXAMPLE 1
|
||||||
|
```
|
||||||
|
Connect-SnipeitPS -Url $url -apiKey $myapikey
|
||||||
|
Connect to Snipe it api.
|
||||||
|
```
|
||||||
|
|
||||||
|
### EXAMPLE 2
|
||||||
|
```
|
||||||
|
Connect-SnipeitPS -Url $url -SecureApiKey $myapikey
|
||||||
|
Connects to Snipe it api with apikey stored to securestring
|
||||||
|
```
|
||||||
|
|
||||||
|
### EXAMPLE 3
|
||||||
|
```
|
||||||
|
Connect-SnipeitPS -siteCred (Get-Credential -message "Use site url as username and apikey as password")
|
||||||
|
Connect to Snipe It with PSCredential object.
|
||||||
|
To use saved creadentials yu can use export-clixml and import-clixml commandlets.
|
||||||
|
```
|
||||||
|
|
||||||
|
### EXAMPLE 4
|
||||||
|
```
|
||||||
|
Build credential with apikey value from secret vault (Microsoft.PowerShell.SecretManagement)
|
||||||
|
$siteurl = "https://mysnipeitsite.url"
|
||||||
|
$apikey = Get-SecretInfo -Name SnipeItApiKey
|
||||||
|
$siteCred = New-Object -Type PSCredential -Argumentlist $siteurl,$spikey
|
||||||
|
Connect-SnipeitPS -siteCred $siteCred
|
||||||
|
```
|
||||||
|
|
||||||
|
## PARAMETERS
|
||||||
|
|
||||||
|
### -apiKey
|
||||||
|
User's API Key for Snipeit.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
Type: String
|
||||||
|
Parameter Sets: Connect with url and apikey
|
||||||
|
Aliases:
|
||||||
|
|
||||||
|
Required: True
|
||||||
|
Position: Named
|
||||||
|
Default value: None
|
||||||
|
Accept pipeline input: False
|
||||||
|
Accept wildcard characters: False
|
||||||
|
```
|
||||||
|
|
||||||
|
### -secureApiKey
|
||||||
|
Snipe it Api key as securestring
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
Type: SecureString
|
||||||
|
Parameter Sets: Connect with url and secure apikey
|
||||||
|
Aliases:
|
||||||
|
|
||||||
|
Required: True
|
||||||
|
Position: Named
|
||||||
|
Default value: None
|
||||||
|
Accept pipeline input: False
|
||||||
|
Accept wildcard characters: False
|
||||||
|
```
|
||||||
|
|
||||||
|
### -siteCred
|
||||||
|
PSCredential where username shoul be snipe it url and password should be
|
||||||
|
snipe it apikey.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
Type: PSCredential
|
||||||
|
Parameter Sets: Connect with credential
|
||||||
|
Aliases:
|
||||||
|
|
||||||
|
Required: True
|
||||||
|
Position: Named
|
||||||
|
Default value: None
|
||||||
|
Accept pipeline input: False
|
||||||
|
Accept wildcard characters: False
|
||||||
|
```
|
||||||
|
|
||||||
|
### -url
|
||||||
|
URL of Snipeit system.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
Type: Uri
|
||||||
|
Parameter Sets: Connect with url and apikey, Connect with url and secure apikey
|
||||||
|
Aliases:
|
||||||
|
|
||||||
|
Required: True
|
||||||
|
Position: Named
|
||||||
|
Default value: None
|
||||||
|
Accept pipeline input: False
|
||||||
|
Accept wildcard characters: False
|
||||||
|
```
|
||||||
|
|
||||||
|
### CommonParameters
|
||||||
|
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).
|
||||||
|
|
||||||
|
## INPUTS
|
||||||
|
|
||||||
|
## OUTPUTS
|
||||||
|
|
||||||
|
## NOTES
|
||||||
|
|
||||||
|
## RELATED LINKS
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
external help file: SnipeitPS-help.xml
|
external help file: SnipeitPS-help.xml
|
||||||
Module Name: SnipeitPS
|
Module Name: snipeitps
|
||||||
online version:
|
online version:
|
||||||
schema: 2.0.0
|
schema: 2.0.0
|
||||||
---
|
---
|
||||||
|
|
@ -16,17 +16,17 @@ Gets a list of Snipe-it Accessories
|
||||||
```
|
```
|
||||||
Get-SnipeitAccessory [-search <String>] [-company_id <Int32>] [-category_id <Int32>] [-manufacturer_id <Int32>]
|
Get-SnipeitAccessory [-search <String>] [-company_id <Int32>] [-category_id <Int32>] [-manufacturer_id <Int32>]
|
||||||
[-supplier_id <Int32>] [-sort <String>] [-order <String>] [-limit <Int32>] [-offset <Int32>] [-all]
|
[-supplier_id <Int32>] [-sort <String>] [-order <String>] [-limit <Int32>] [-offset <Int32>] [-all]
|
||||||
-url <String> -apiKey <String> [<CommonParameters>]
|
[-url <String>] [-apiKey <String>] [<CommonParameters>]
|
||||||
```
|
```
|
||||||
|
|
||||||
### Get by ID
|
### Get by ID
|
||||||
```
|
```
|
||||||
Get-SnipeitAccessory [-id <Int32>] -url <String> -apiKey <String> [<CommonParameters>]
|
Get-SnipeitAccessory [-id <Int32>] [-url <String>] [-apiKey <String>] [<CommonParameters>]
|
||||||
```
|
```
|
||||||
|
|
||||||
### Accessories checked out to user id
|
### Accessories checked out to user id
|
||||||
```
|
```
|
||||||
Get-SnipeitAccessory [-user_id <Int32>] [-all] -url <String> -apiKey <String> [<CommonParameters>]
|
Get-SnipeitAccessory [-user_id <Int32>] [-all] [-url <String>] [-apiKey <String>] [<CommonParameters>]
|
||||||
```
|
```
|
||||||
|
|
||||||
## DESCRIPTION
|
## DESCRIPTION
|
||||||
|
|
@ -68,14 +68,15 @@ Accept wildcard characters: False
|
||||||
```
|
```
|
||||||
|
|
||||||
### -apiKey
|
### -apiKey
|
||||||
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead.
|
||||||
|
Users API Key for Snipeit.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
Type: String
|
Type: String
|
||||||
Parameter Sets: (All)
|
Parameter Sets: (All)
|
||||||
Aliases:
|
Aliases:
|
||||||
|
|
||||||
Required: True
|
Required: False
|
||||||
Position: Named
|
Position: Named
|
||||||
Default value: None
|
Default value: None
|
||||||
Accept pipeline input: False
|
Accept pipeline input: False
|
||||||
|
|
@ -235,14 +236,15 @@ Accept wildcard characters: False
|
||||||
```
|
```
|
||||||
|
|
||||||
### -url
|
### -url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead.
|
||||||
|
URL of Snipeit system.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
Type: String
|
Type: String
|
||||||
Parameter Sets: (All)
|
Parameter Sets: (All)
|
||||||
Aliases:
|
Aliases:
|
||||||
|
|
||||||
Required: True
|
Required: False
|
||||||
Position: Named
|
Position: Named
|
||||||
Default value: None
|
Default value: None
|
||||||
Accept pipeline input: False
|
Accept pipeline input: False
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
external help file: SnipeitPS-help.xml
|
external help file: SnipeitPS-help.xml
|
||||||
Module Name: SnipeitPS
|
Module Name: snipeitps
|
||||||
online version:
|
online version:
|
||||||
schema: 2.0.0
|
schema: 2.0.0
|
||||||
---
|
---
|
||||||
|
|
@ -13,7 +13,7 @@ Get list of checked out accessories
|
||||||
## SYNTAX
|
## SYNTAX
|
||||||
|
|
||||||
```
|
```
|
||||||
Get-SnipeitAccessoryOwner [-id] <Int32> [-url] <String> [-apiKey] <String> [-WhatIf] [-Confirm]
|
Get-SnipeitAccessoryOwner [-id] <Int32> [[-url] <String>] [[-apiKey] <String>] [-WhatIf] [-Confirm]
|
||||||
[<CommonParameters>]
|
[<CommonParameters>]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -30,14 +30,15 @@ Get-SnipeitAccessoryOwner -id 1
|
||||||
## PARAMETERS
|
## PARAMETERS
|
||||||
|
|
||||||
### -apiKey
|
### -apiKey
|
||||||
User's API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead.
|
||||||
|
User's API Key for Snipeit.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
Type: String
|
Type: String
|
||||||
Parameter Sets: (All)
|
Parameter Sets: (All)
|
||||||
Aliases:
|
Aliases:
|
||||||
|
|
||||||
Required: True
|
Required: False
|
||||||
Position: 3
|
Position: 3
|
||||||
Default value: None
|
Default value: None
|
||||||
Accept pipeline input: False
|
Accept pipeline input: False
|
||||||
|
|
@ -60,14 +61,15 @@ Accept wildcard characters: False
|
||||||
```
|
```
|
||||||
|
|
||||||
### -url
|
### -url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead.
|
||||||
|
URL of Snipeit system.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
Type: String
|
Type: String
|
||||||
Parameter Sets: (All)
|
Parameter Sets: (All)
|
||||||
Aliases:
|
Aliases:
|
||||||
|
|
||||||
Required: True
|
Required: False
|
||||||
Position: 2
|
Position: 2
|
||||||
Default value: None
|
Default value: None
|
||||||
Accept pipeline input: False
|
Accept pipeline input: False
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
external help file: SnipeitPS-help.xml
|
external help file: SnipeitPS-help.xml
|
||||||
Module Name: SnipeitPS
|
Module Name: snipeitps
|
||||||
online version:
|
online version:
|
||||||
schema: 2.0.0
|
schema: 2.0.0
|
||||||
---
|
---
|
||||||
|
|
@ -15,7 +15,7 @@ Gets and search Snipe-it Activity history
|
||||||
```
|
```
|
||||||
Get-SnipeitActivity [[-search] <String>] [[-target_type] <String>] [[-target_id] <Int32>]
|
Get-SnipeitActivity [[-search] <String>] [[-target_type] <String>] [[-target_id] <Int32>]
|
||||||
[[-item_type] <String>] [[-item_id] <Int32>] [[-action_type] <String>] [[-limit] <Int32>] [[-offset] <Int32>]
|
[[-item_type] <String>] [[-item_id] <Int32>] [[-action_type] <String>] [[-limit] <Int32>] [[-offset] <Int32>]
|
||||||
[-all] [-url] <String> [-apiKey] <String> [<CommonParameters>]
|
[-all] [[-url] <String>] [[-apiKey] <String>] [<CommonParameters>]
|
||||||
```
|
```
|
||||||
|
|
||||||
## DESCRIPTION
|
## DESCRIPTION
|
||||||
|
|
@ -67,14 +67,15 @@ Accept wildcard characters: False
|
||||||
```
|
```
|
||||||
|
|
||||||
### -apiKey
|
### -apiKey
|
||||||
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead.
|
||||||
|
Users API Key for Snipeit.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
Type: String
|
Type: String
|
||||||
Parameter Sets: (All)
|
Parameter Sets: (All)
|
||||||
Aliases:
|
Aliases:
|
||||||
|
|
||||||
Required: True
|
Required: False
|
||||||
Position: 10
|
Position: 10
|
||||||
Default value: None
|
Default value: None
|
||||||
Accept pipeline input: False
|
Accept pipeline input: False
|
||||||
|
|
@ -189,14 +190,15 @@ Accept wildcard characters: False
|
||||||
```
|
```
|
||||||
|
|
||||||
### -url
|
### -url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead.
|
||||||
|
URL of Snipeit system.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
Type: String
|
Type: String
|
||||||
Parameter Sets: (All)
|
Parameter Sets: (All)
|
||||||
Aliases:
|
Aliases:
|
||||||
|
|
||||||
Required: True
|
Required: False
|
||||||
Position: 9
|
Position: 9
|
||||||
Default value: None
|
Default value: None
|
||||||
Accept pipeline input: False
|
Accept pipeline input: False
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
external help file: SnipeitPS-help.xml
|
external help file: SnipeitPS-help.xml
|
||||||
Module Name: SnipeitPS
|
Module Name: snipeitps
|
||||||
online version:
|
online version:
|
||||||
schema: 2.0.0
|
schema: 2.0.0
|
||||||
---
|
---
|
||||||
|
|
@ -17,46 +17,46 @@ Gets a list of Snipe-it Assets or specific asset
|
||||||
Get-SnipeitAsset [-search <String>] [-order_number <String>] [-model_id <Int32>] [-category_id <Int32>]
|
Get-SnipeitAsset [-search <String>] [-order_number <String>] [-model_id <Int32>] [-category_id <Int32>]
|
||||||
[-manufacturer_id <Int32>] [-company_id <Int32>] [-location_id <Int32>] [-depreciation_id <Int32>]
|
[-manufacturer_id <Int32>] [-company_id <Int32>] [-location_id <Int32>] [-depreciation_id <Int32>]
|
||||||
[-requestable <Boolean>] [-status <String>] [-status_id <Int32>] [-sort <String>] [-order <String>]
|
[-requestable <Boolean>] [-status <String>] [-status_id <Int32>] [-sort <String>] [-order <String>]
|
||||||
[-limit <Int32>] [-offset <Int32>] [-all] -url <String> -apiKey <String> [<CommonParameters>]
|
[-limit <Int32>] [-offset <Int32>] [-all] [-url <String>] [-apiKey <String>] [<CommonParameters>]
|
||||||
```
|
```
|
||||||
|
|
||||||
### Get with id
|
### Get with id
|
||||||
```
|
```
|
||||||
Get-SnipeitAsset [-id <Int32>] -url <String> -apiKey <String> [<CommonParameters>]
|
Get-SnipeitAsset [-id <Int32>] [-url <String>] [-apiKey <String>] [<CommonParameters>]
|
||||||
```
|
```
|
||||||
|
|
||||||
### Get with asset tag
|
### Get with asset tag
|
||||||
```
|
```
|
||||||
Get-SnipeitAsset [-asset_tag <String>] -url <String> -apiKey <String> [<CommonParameters>]
|
Get-SnipeitAsset [-asset_tag <String>] [-url <String>] [-apiKey <String>] [<CommonParameters>]
|
||||||
```
|
```
|
||||||
|
|
||||||
### Get with serial
|
### Get with serial
|
||||||
```
|
```
|
||||||
Get-SnipeitAsset [-serial <String>] -url <String> -apiKey <String> [<CommonParameters>]
|
Get-SnipeitAsset [-serial <String>] [-url <String>] [-apiKey <String>] [<CommonParameters>]
|
||||||
```
|
```
|
||||||
|
|
||||||
### Assets due auditing soon
|
### Assets due auditing soon
|
||||||
```
|
```
|
||||||
Get-SnipeitAsset [-audit_due] [-sort <String>] [-order <String>] [-limit <Int32>] [-offset <Int32>] [-all]
|
Get-SnipeitAsset [-audit_due] [-sort <String>] [-order <String>] [-limit <Int32>] [-offset <Int32>] [-all]
|
||||||
-url <String> -apiKey <String> [<CommonParameters>]
|
[-url <String>] [-apiKey <String>] [<CommonParameters>]
|
||||||
```
|
```
|
||||||
|
|
||||||
### Assets overdue for auditing
|
### Assets overdue for auditing
|
||||||
```
|
```
|
||||||
Get-SnipeitAsset [-audit_overdue] [-sort <String>] [-order <String>] [-limit <Int32>] [-offset <Int32>] [-all]
|
Get-SnipeitAsset [-audit_overdue] [-sort <String>] [-order <String>] [-limit <Int32>] [-offset <Int32>] [-all]
|
||||||
-url <String> -apiKey <String> [<CommonParameters>]
|
[-url <String>] [-apiKey <String>] [<CommonParameters>]
|
||||||
```
|
```
|
||||||
|
|
||||||
### Assets checked out to user id
|
### Assets checked out to user id
|
||||||
```
|
```
|
||||||
Get-SnipeitAsset [-user_id <Int32>] [-sort <String>] [-order <String>] [-limit <Int32>] [-offset <Int32>]
|
Get-SnipeitAsset [-user_id <Int32>] [-sort <String>] [-order <String>] [-limit <Int32>] [-offset <Int32>]
|
||||||
[-all] -url <String> -apiKey <String> [<CommonParameters>]
|
[-all] [-url <String>] [-apiKey <String>] [<CommonParameters>]
|
||||||
```
|
```
|
||||||
|
|
||||||
### Assets with component id
|
### Assets with component id
|
||||||
```
|
```
|
||||||
Get-SnipeitAsset [-component_id <Int32>] [-sort <String>] [-order <String>] [-limit <Int32>] [-offset <Int32>]
|
Get-SnipeitAsset [-component_id <Int32>] [-sort <String>] [-order <String>] [-limit <Int32>] [-offset <Int32>]
|
||||||
[-all] -url <String> -apiKey <String> [<CommonParameters>]
|
[-all] [-url <String>] [-apiKey <String>] [<CommonParameters>]
|
||||||
```
|
```
|
||||||
|
|
||||||
## DESCRIPTION
|
## DESCRIPTION
|
||||||
|
|
@ -66,7 +66,7 @@ Get-SnipeitAsset [-component_id <Int32>] [-sort <String>] [-order <String>] [-li
|
||||||
|
|
||||||
### EXAMPLE 1
|
### EXAMPLE 1
|
||||||
```
|
```
|
||||||
Get-SnipeitAsset -all -url "https://assets.example.com"-token "token..."
|
Get-SnipeitAsset -all
|
||||||
Returens all assets
|
Returens all assets
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -136,14 +136,15 @@ Accept wildcard characters: False
|
||||||
```
|
```
|
||||||
|
|
||||||
### -apiKey
|
### -apiKey
|
||||||
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead.
|
||||||
|
Users API Key for Snipeit.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
Type: String
|
Type: String
|
||||||
Parameter Sets: (All)
|
Parameter Sets: (All)
|
||||||
Aliases:
|
Aliases:
|
||||||
|
|
||||||
Required: True
|
Required: False
|
||||||
Position: Named
|
Position: Named
|
||||||
Default value: None
|
Default value: None
|
||||||
Accept pipeline input: False
|
Accept pipeline input: False
|
||||||
|
|
@ -468,14 +469,15 @@ Accept wildcard characters: False
|
||||||
```
|
```
|
||||||
|
|
||||||
### -url
|
### -url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead.
|
||||||
|
URL of Snipeit system.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
Type: String
|
Type: String
|
||||||
Parameter Sets: (All)
|
Parameter Sets: (All)
|
||||||
Aliases:
|
Aliases:
|
||||||
|
|
||||||
Required: True
|
Required: False
|
||||||
Position: Named
|
Position: Named
|
||||||
Default value: None
|
Default value: None
|
||||||
Accept pipeline input: False
|
Accept pipeline input: False
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
external help file: SnipeitPS-help.xml
|
external help file: SnipeitPS-help.xml
|
||||||
Module Name: SnipeitPS
|
Module Name: snipeitps
|
||||||
online version:
|
online version:
|
||||||
schema: 2.0.0
|
schema: 2.0.0
|
||||||
---
|
---
|
||||||
|
|
@ -14,7 +14,7 @@ Lists Snipe-it Assets Maintenances
|
||||||
|
|
||||||
```
|
```
|
||||||
Get-SnipeitAssetMaintenance [[-search] <String>] [[-asset_id] <Int32>] [[-sort] <String>] [[-order] <String>]
|
Get-SnipeitAssetMaintenance [[-search] <String>] [[-asset_id] <Int32>] [[-sort] <String>] [[-order] <String>]
|
||||||
[[-limit] <Int32>] [-all] [[-offset] <Int32>] [-url] <String> [-apiKey] <String> [<CommonParameters>]
|
[[-limit] <Int32>] [-all] [[-offset] <Int32>] [[-url] <String>] [[-apiKey] <String>] [<CommonParameters>]
|
||||||
```
|
```
|
||||||
|
|
||||||
## DESCRIPTION
|
## DESCRIPTION
|
||||||
|
|
@ -24,17 +24,17 @@ Get-SnipeitAssetMaintenance [[-search] <String>] [[-asset_id] <Int32>] [[-sort]
|
||||||
|
|
||||||
### EXAMPLE 1
|
### EXAMPLE 1
|
||||||
```
|
```
|
||||||
Get-SnipeitAssetMaintenances -url "https://assets.example.com" -token "token..."
|
Get-SnipeitAssetMaintenances
|
||||||
```
|
```
|
||||||
|
|
||||||
### EXAMPLE 2
|
### EXAMPLE 2
|
||||||
```
|
```
|
||||||
Get-SnipeitAssetMaintenances -search "myMachine" -url "https://assets.example.com" -token "token..."
|
Get-SnipeitAssetMaintenances -search "myMachine"
|
||||||
```
|
```
|
||||||
|
|
||||||
### EXAMPLE 3
|
### EXAMPLE 3
|
||||||
```
|
```
|
||||||
Get-SnipeitAssetMaintenances -search "myMachine" -url "https://assets.example.com" -token "token..."
|
Get-SnipeitAssetMaintenances -search "myMachine"
|
||||||
```
|
```
|
||||||
|
|
||||||
## PARAMETERS
|
## PARAMETERS
|
||||||
|
|
@ -55,14 +55,15 @@ Accept wildcard characters: False
|
||||||
```
|
```
|
||||||
|
|
||||||
### -apiKey
|
### -apiKey
|
||||||
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead.
|
||||||
|
Users API Key for Snipeit.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
Type: String
|
Type: String
|
||||||
Parameter Sets: (All)
|
Parameter Sets: (All)
|
||||||
Aliases:
|
Aliases:
|
||||||
|
|
||||||
Required: True
|
Required: False
|
||||||
Position: 8
|
Position: 8
|
||||||
Default value: None
|
Default value: None
|
||||||
Accept pipeline input: False
|
Accept pipeline input: False
|
||||||
|
|
@ -162,14 +163,15 @@ Accept wildcard characters: False
|
||||||
```
|
```
|
||||||
|
|
||||||
### -url
|
### -url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead.
|
||||||
|
URL of Snipeit system.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
Type: String
|
Type: String
|
||||||
Parameter Sets: (All)
|
Parameter Sets: (All)
|
||||||
Aliases:
|
Aliases:
|
||||||
|
|
||||||
Required: True
|
Required: False
|
||||||
Position: 7
|
Position: 7
|
||||||
Default value: None
|
Default value: None
|
||||||
Accept pipeline input: False
|
Accept pipeline input: False
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
external help file: SnipeitPS-help.xml
|
external help file: SnipeitPS-help.xml
|
||||||
Module Name: SnipeitPS
|
Module Name: snipeitps
|
||||||
online version:
|
online version:
|
||||||
schema: 2.0.0
|
schema: 2.0.0
|
||||||
---
|
---
|
||||||
|
|
@ -15,12 +15,12 @@ Gets a list of Snipe-it Categories
|
||||||
### Search (Default)
|
### Search (Default)
|
||||||
```
|
```
|
||||||
Get-SnipeitCategory [-search <String>] [-order <String>] [-limit <Int32>] [-offset <Int32>] [-all]
|
Get-SnipeitCategory [-search <String>] [-order <String>] [-limit <Int32>] [-offset <Int32>] [-all]
|
||||||
-url <String> -apiKey <String> [<CommonParameters>]
|
[-url <String>] [-apiKey <String>] [<CommonParameters>]
|
||||||
```
|
```
|
||||||
|
|
||||||
### Get with ID
|
### Get with ID
|
||||||
```
|
```
|
||||||
Get-SnipeitCategory [-id <Int32>] -url <String> -apiKey <String> [<CommonParameters>]
|
Get-SnipeitCategory [-id <Int32>] [-url <String>] [-apiKey <String>] [<CommonParameters>]
|
||||||
```
|
```
|
||||||
|
|
||||||
## DESCRIPTION
|
## DESCRIPTION
|
||||||
|
|
@ -56,14 +56,15 @@ Accept wildcard characters: False
|
||||||
```
|
```
|
||||||
|
|
||||||
### -apiKey
|
### -apiKey
|
||||||
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead.
|
||||||
|
Users API Key for Snipeit.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
Type: String
|
Type: String
|
||||||
Parameter Sets: (All)
|
Parameter Sets: (All)
|
||||||
Aliases:
|
Aliases:
|
||||||
|
|
||||||
Required: True
|
Required: False
|
||||||
Position: Named
|
Position: Named
|
||||||
Default value: None
|
Default value: None
|
||||||
Accept pipeline input: False
|
Accept pipeline input: False
|
||||||
|
|
@ -148,14 +149,15 @@ Accept wildcard characters: False
|
||||||
```
|
```
|
||||||
|
|
||||||
### -url
|
### -url
|
||||||
Url of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead.
|
||||||
|
Url of Snipeit system.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
Type: String
|
Type: String
|
||||||
Parameter Sets: (All)
|
Parameter Sets: (All)
|
||||||
Aliases:
|
Aliases:
|
||||||
|
|
||||||
Required: True
|
Required: False
|
||||||
Position: Named
|
Position: Named
|
||||||
Default value: None
|
Default value: None
|
||||||
Accept pipeline input: False
|
Accept pipeline input: False
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
external help file: SnipeitPS-help.xml
|
external help file: SnipeitPS-help.xml
|
||||||
Module Name: SnipeitPS
|
Module Name: snipeitps
|
||||||
online version:
|
online version:
|
||||||
schema: 2.0.0
|
schema: 2.0.0
|
||||||
---
|
---
|
||||||
|
|
@ -14,13 +14,13 @@ Gets a list of Snipe-it Companies
|
||||||
|
|
||||||
### Search (Default)
|
### Search (Default)
|
||||||
```
|
```
|
||||||
Get-SnipeitCompany [-search <String>] [-order <String>] [-limit <Int32>] [-offset <Int32>] [-all] -url <String>
|
Get-SnipeitCompany [-search <String>] [-order <String>] [-limit <Int32>] [-offset <Int32>] [-all]
|
||||||
-apiKey <String> [<CommonParameters>]
|
[-url <String>] [-apiKey <String>] [<CommonParameters>]
|
||||||
```
|
```
|
||||||
|
|
||||||
### Get with ID
|
### Get with ID
|
||||||
```
|
```
|
||||||
Get-SnipeitCompany [-id <Int32>] -url <String> -apiKey <String> [<CommonParameters>]
|
Get-SnipeitCompany [-id <Int32>] [-url <String>] [-apiKey <String>] [<CommonParameters>]
|
||||||
```
|
```
|
||||||
|
|
||||||
## DESCRIPTION
|
## DESCRIPTION
|
||||||
|
|
@ -58,14 +58,15 @@ Accept wildcard characters: False
|
||||||
```
|
```
|
||||||
|
|
||||||
### -apiKey
|
### -apiKey
|
||||||
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead.
|
||||||
|
Users API Key for Snipeit.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
Type: String
|
Type: String
|
||||||
Parameter Sets: (All)
|
Parameter Sets: (All)
|
||||||
Aliases:
|
Aliases:
|
||||||
|
|
||||||
Required: True
|
Required: False
|
||||||
Position: Named
|
Position: Named
|
||||||
Default value: None
|
Default value: None
|
||||||
Accept pipeline input: False
|
Accept pipeline input: False
|
||||||
|
|
@ -150,14 +151,15 @@ Accept wildcard characters: False
|
||||||
```
|
```
|
||||||
|
|
||||||
### -url
|
### -url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead.
|
||||||
|
URL of Snipeit system.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
Type: String
|
Type: String
|
||||||
Parameter Sets: (All)
|
Parameter Sets: (All)
|
||||||
Aliases:
|
Aliases:
|
||||||
|
|
||||||
Required: True
|
Required: False
|
||||||
Position: Named
|
Position: Named
|
||||||
Default value: None
|
Default value: None
|
||||||
Accept pipeline input: False
|
Accept pipeline input: False
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
external help file: SnipeitPS-help.xml
|
external help file: SnipeitPS-help.xml
|
||||||
Module Name: SnipeitPS
|
Module Name: snipeitps
|
||||||
online version:
|
online version:
|
||||||
schema: 2.0.0
|
schema: 2.0.0
|
||||||
---
|
---
|
||||||
|
|
@ -15,13 +15,13 @@ Gets a list of Snipe-it Components
|
||||||
### Search (Default)
|
### Search (Default)
|
||||||
```
|
```
|
||||||
Get-SnipeitComponent [-search <String>] [-category_id <Int32>] [-company_id <Int32>] [-location_id <Int32>]
|
Get-SnipeitComponent [-search <String>] [-category_id <Int32>] [-company_id <Int32>] [-location_id <Int32>]
|
||||||
[-order <String>] [-sort <String>] [-limit <Int32>] [-offset <Int32>] [-all] -url <String> -apiKey <String>
|
[-order <String>] [-sort <String>] [-limit <Int32>] [-offset <Int32>] [-all] [-url <String>]
|
||||||
[<CommonParameters>]
|
[-apiKey <String>] [<CommonParameters>]
|
||||||
```
|
```
|
||||||
|
|
||||||
### Get with ID
|
### Get with ID
|
||||||
```
|
```
|
||||||
Get-SnipeitComponent [-id <Int32>] -url <String> -apiKey <String> [<CommonParameters>]
|
Get-SnipeitComponent [-id <Int32>] [-url <String>] [-apiKey <String>] [<CommonParameters>]
|
||||||
```
|
```
|
||||||
|
|
||||||
## DESCRIPTION
|
## DESCRIPTION
|
||||||
|
|
@ -65,14 +65,15 @@ Accept wildcard characters: False
|
||||||
```
|
```
|
||||||
|
|
||||||
### -apiKey
|
### -apiKey
|
||||||
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead.
|
||||||
|
Users API Key for Snipeit.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
Type: String
|
Type: String
|
||||||
Parameter Sets: (All)
|
Parameter Sets: (All)
|
||||||
Aliases:
|
Aliases:
|
||||||
|
|
||||||
Required: True
|
Required: False
|
||||||
Position: Named
|
Position: Named
|
||||||
Default value: None
|
Default value: None
|
||||||
Accept pipeline input: False
|
Accept pipeline input: False
|
||||||
|
|
@ -217,14 +218,15 @@ Accept wildcard characters: False
|
||||||
```
|
```
|
||||||
|
|
||||||
### -url
|
### -url
|
||||||
URL of Snipeit system,can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead.
|
||||||
|
URL of Snipeit system.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
Type: String
|
Type: String
|
||||||
Parameter Sets: (All)
|
Parameter Sets: (All)
|
||||||
Aliases:
|
Aliases:
|
||||||
|
|
||||||
Required: True
|
Required: False
|
||||||
Position: Named
|
Position: Named
|
||||||
Default value: None
|
Default value: None
|
||||||
Accept pipeline input: False
|
Accept pipeline input: False
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
external help file: SnipeitPS-help.xml
|
external help file: SnipeitPS-help.xml
|
||||||
Module Name: SnipeitPS
|
Module Name: snipeitps
|
||||||
online version:
|
online version:
|
||||||
schema: 2.0.0
|
schema: 2.0.0
|
||||||
---
|
---
|
||||||
|
|
@ -16,12 +16,12 @@ Gets a list of Snipe-it consumables
|
||||||
```
|
```
|
||||||
Get-SnipeitConsumable [-search <String>] [-category_id <Int32>] [-company_id <Int32>]
|
Get-SnipeitConsumable [-search <String>] [-category_id <Int32>] [-company_id <Int32>]
|
||||||
[-manufacturer_id <Int32>] [-location_id <Int32>] [-order <String>] [-sort <String>] [-expand]
|
[-manufacturer_id <Int32>] [-location_id <Int32>] [-order <String>] [-sort <String>] [-expand]
|
||||||
[-limit <Int32>] [-offset <Int32>] [-all] -url <String> -apiKey <String> [<CommonParameters>]
|
[-limit <Int32>] [-offset <Int32>] [-all] [-url <String>] [-apiKey <String>] [<CommonParameters>]
|
||||||
```
|
```
|
||||||
|
|
||||||
### Get with ID
|
### Get with ID
|
||||||
```
|
```
|
||||||
Get-SnipeitConsumable [-id <Int32[]>] -url <String> -apiKey <String> [<CommonParameters>]
|
Get-SnipeitConsumable [-id <Int32[]>] [-url <String>] [-apiKey <String>] [<CommonParameters>]
|
||||||
```
|
```
|
||||||
|
|
||||||
## DESCRIPTION
|
## DESCRIPTION
|
||||||
|
|
@ -65,14 +65,15 @@ Accept wildcard characters: False
|
||||||
```
|
```
|
||||||
|
|
||||||
### -apiKey
|
### -apiKey
|
||||||
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead.
|
||||||
|
Users API Key for Snipeit.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
Type: String
|
Type: String
|
||||||
Parameter Sets: (All)
|
Parameter Sets: (All)
|
||||||
Aliases:
|
Aliases:
|
||||||
|
|
||||||
Required: True
|
Required: False
|
||||||
Position: Named
|
Position: Named
|
||||||
Default value: None
|
Default value: None
|
||||||
Accept pipeline input: False
|
Accept pipeline input: False
|
||||||
|
|
@ -247,14 +248,15 @@ Accept wildcard characters: False
|
||||||
```
|
```
|
||||||
|
|
||||||
### -url
|
### -url
|
||||||
URL of Snipeit system,can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead.
|
||||||
|
URL of Snipeit system.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
Type: String
|
Type: String
|
||||||
Parameter Sets: (All)
|
Parameter Sets: (All)
|
||||||
Aliases:
|
Aliases:
|
||||||
|
|
||||||
Required: True
|
Required: False
|
||||||
Position: Named
|
Position: Named
|
||||||
Default value: None
|
Default value: None
|
||||||
Accept pipeline input: False
|
Accept pipeline input: False
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
external help file: SnipeitPS-help.xml
|
external help file: SnipeitPS-help.xml
|
||||||
Module Name: SnipeitPS
|
Module Name: snipeitps
|
||||||
online version:
|
online version:
|
||||||
schema: 2.0.0
|
schema: 2.0.0
|
||||||
---
|
---
|
||||||
|
|
@ -13,7 +13,7 @@ Returns specific Snipe-IT custom field or a list of all custom field
|
||||||
## SYNTAX
|
## SYNTAX
|
||||||
|
|
||||||
```
|
```
|
||||||
Get-SnipeitCustomField [[-id] <Int32>] [-url] <String> [-apiKey] <String> [<CommonParameters>]
|
Get-SnipeitCustomField [[-id] <Int32>] [[-url] <String>] [[-apiKey] <String>] [<CommonParameters>]
|
||||||
```
|
```
|
||||||
|
|
||||||
## DESCRIPTION
|
## DESCRIPTION
|
||||||
|
|
@ -23,20 +23,28 @@ Get-SnipeitCustomField [[-id] <Int32>] [-url] <String> [-apiKey] <String> [<Comm
|
||||||
|
|
||||||
### EXAMPLE 1
|
### EXAMPLE 1
|
||||||
```
|
```
|
||||||
Get-SnipeitCustomField -url "https://assets.example.com" -token "token..."
|
Get-SnipeitCustomField
|
||||||
|
Get all custom fields
|
||||||
|
```
|
||||||
|
|
||||||
|
### EXAMPLE 2
|
||||||
|
```
|
||||||
|
Get-SnipeitCustomField -id 1
|
||||||
|
Get custom field with ID 1
|
||||||
```
|
```
|
||||||
|
|
||||||
## PARAMETERS
|
## PARAMETERS
|
||||||
|
|
||||||
### -apiKey
|
### -apiKey
|
||||||
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead.
|
||||||
|
Users API Key for Snipeit.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
Type: String
|
Type: String
|
||||||
Parameter Sets: (All)
|
Parameter Sets: (All)
|
||||||
Aliases:
|
Aliases:
|
||||||
|
|
||||||
Required: True
|
Required: False
|
||||||
Position: 3
|
Position: 3
|
||||||
Default value: None
|
Default value: None
|
||||||
Accept pipeline input: False
|
Accept pipeline input: False
|
||||||
|
|
@ -59,14 +67,15 @@ Accept wildcard characters: False
|
||||||
```
|
```
|
||||||
|
|
||||||
### -url
|
### -url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead.
|
||||||
|
URL of Snipeit system.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
Type: String
|
Type: String
|
||||||
Parameter Sets: (All)
|
Parameter Sets: (All)
|
||||||
Aliases:
|
Aliases:
|
||||||
|
|
||||||
Required: True
|
Required: False
|
||||||
Position: 2
|
Position: 2
|
||||||
Default value: None
|
Default value: None
|
||||||
Accept pipeline input: False
|
Accept pipeline input: False
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
external help file: SnipeitPS-help.xml
|
external help file: SnipeitPS-help.xml
|
||||||
Module Name: SnipeitPS
|
Module Name: snipeitps
|
||||||
online version:
|
online version:
|
||||||
schema: 2.0.0
|
schema: 2.0.0
|
||||||
---
|
---
|
||||||
|
|
@ -15,12 +15,12 @@ Gets a list of Snipe-it Departments
|
||||||
### Search (Default)
|
### Search (Default)
|
||||||
```
|
```
|
||||||
Get-SnipeitDepartment [-search <String>] [-order <String>] [-limit <Int32>] [-offset <Int32>] [-all]
|
Get-SnipeitDepartment [-search <String>] [-order <String>] [-limit <Int32>] [-offset <Int32>] [-all]
|
||||||
[-sort <String>] -url <String> -apiKey <String> [<CommonParameters>]
|
[-sort <String>] [-url <String>] [-apiKey <String>] [<CommonParameters>]
|
||||||
```
|
```
|
||||||
|
|
||||||
### Get with ID
|
### Get with ID
|
||||||
```
|
```
|
||||||
Get-SnipeitDepartment [-id <Int32>] -url <String> -apiKey <String> [<CommonParameters>]
|
Get-SnipeitDepartment [-id <Int32>] [-url <String>] [-apiKey <String>] [<CommonParameters>]
|
||||||
```
|
```
|
||||||
|
|
||||||
## DESCRIPTION
|
## DESCRIPTION
|
||||||
|
|
@ -30,7 +30,7 @@ Get-SnipeitDepartment [-id <Int32>] -url <String> -apiKey <String> [<CommonParam
|
||||||
|
|
||||||
### EXAMPLE 1
|
### EXAMPLE 1
|
||||||
```
|
```
|
||||||
Get-SnipeitDepartment -url "https://assets.example.com" -token "token..."
|
Get-SnipeitDepartment
|
||||||
```
|
```
|
||||||
|
|
||||||
### EXAMPLE 2
|
### EXAMPLE 2
|
||||||
|
|
@ -61,14 +61,15 @@ Accept wildcard characters: False
|
||||||
```
|
```
|
||||||
|
|
||||||
### -apiKey
|
### -apiKey
|
||||||
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead.
|
||||||
|
Users API Key for Snipeit.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
Type: String
|
Type: String
|
||||||
Parameter Sets: (All)
|
Parameter Sets: (All)
|
||||||
Aliases:
|
Aliases:
|
||||||
|
|
||||||
Required: True
|
Required: False
|
||||||
Position: Named
|
Position: Named
|
||||||
Default value: None
|
Default value: None
|
||||||
Accept pipeline input: False
|
Accept pipeline input: False
|
||||||
|
|
@ -168,14 +169,15 @@ Accept wildcard characters: False
|
||||||
```
|
```
|
||||||
|
|
||||||
### -url
|
### -url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead.
|
||||||
|
URL of Snipeit system.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
Type: String
|
Type: String
|
||||||
Parameter Sets: (All)
|
Parameter Sets: (All)
|
||||||
Aliases:
|
Aliases:
|
||||||
|
|
||||||
Required: True
|
Required: False
|
||||||
Position: Named
|
Position: Named
|
||||||
Default value: None
|
Default value: None
|
||||||
Accept pipeline input: False
|
Accept pipeline input: False
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
external help file: SnipeitPS-help.xml
|
external help file: SnipeitPS-help.xml
|
||||||
Module Name: SnipeitPS
|
Module Name: snipeitps
|
||||||
online version:
|
online version:
|
||||||
schema: 2.0.0
|
schema: 2.0.0
|
||||||
---
|
---
|
||||||
|
|
@ -13,7 +13,7 @@ Returns a fieldset or list of Snipe-it Fieldsets
|
||||||
## SYNTAX
|
## SYNTAX
|
||||||
|
|
||||||
```
|
```
|
||||||
Get-SnipeitFieldset [[-id] <Int32>] [-url] <String> [-apiKey] <String> [<CommonParameters>]
|
Get-SnipeitFieldset [[-id] <Int32>] [[-url] <String>] [[-apiKey] <String>] [<CommonParameters>]
|
||||||
```
|
```
|
||||||
|
|
||||||
## DESCRIPTION
|
## DESCRIPTION
|
||||||
|
|
@ -23,25 +23,28 @@ Get-SnipeitFieldset [[-id] <Int32>] [-url] <String> [-apiKey] <String> [<CommonP
|
||||||
|
|
||||||
### EXAMPLE 1
|
### EXAMPLE 1
|
||||||
```
|
```
|
||||||
Get-SnipeitFieldset -url "https://assets.example.com" -token "token..."
|
Get-SnipeitFieldset
|
||||||
|
Get all fieldsets
|
||||||
```
|
```
|
||||||
|
|
||||||
### EXAMPLE 2
|
### EXAMPLE 2
|
||||||
```
|
```
|
||||||
Get-SnipeitFieldset -url "https://assets.example.com" -token "token..." | Where-Object {$_.name -eq "Windows" }
|
Get-SnipeitFieldset | Where-Object {$_.name -eq "Windows" }
|
||||||
|
Gets fieldset by name
|
||||||
```
|
```
|
||||||
|
|
||||||
## PARAMETERS
|
## PARAMETERS
|
||||||
|
|
||||||
### -apiKey
|
### -apiKey
|
||||||
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead.
|
||||||
|
Users API Key for Snipeit.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
Type: String
|
Type: String
|
||||||
Parameter Sets: (All)
|
Parameter Sets: (All)
|
||||||
Aliases:
|
Aliases:
|
||||||
|
|
||||||
Required: True
|
Required: False
|
||||||
Position: 3
|
Position: 3
|
||||||
Default value: None
|
Default value: None
|
||||||
Accept pipeline input: False
|
Accept pipeline input: False
|
||||||
|
|
@ -64,14 +67,15 @@ Accept wildcard characters: False
|
||||||
```
|
```
|
||||||
|
|
||||||
### -url
|
### -url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead.
|
||||||
|
URL of Snipeit system.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
Type: String
|
Type: String
|
||||||
Parameter Sets: (All)
|
Parameter Sets: (All)
|
||||||
Aliases:
|
Aliases:
|
||||||
|
|
||||||
Required: True
|
Required: False
|
||||||
Position: 2
|
Position: 2
|
||||||
Default value: None
|
Default value: None
|
||||||
Accept pipeline input: False
|
Accept pipeline input: False
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
external help file: SnipeitPS-help.xml
|
external help file: SnipeitPS-help.xml
|
||||||
Module Name: SnipeitPS
|
Module Name: snipeitps
|
||||||
online version:
|
online version:
|
||||||
schema: 2.0.0
|
schema: 2.0.0
|
||||||
---
|
---
|
||||||
|
|
@ -17,23 +17,23 @@ Gets a list of Snipe-it Licenses
|
||||||
Get-SnipeitLicense [-search <String>] [-name <String>] [-company_id <Int32>] [-product_key <String>]
|
Get-SnipeitLicense [-search <String>] [-name <String>] [-company_id <Int32>] [-product_key <String>]
|
||||||
[-order_number <String>] [-purchase_order <String>] [-license_name <String>] [-license_email <MailAddress>]
|
[-order_number <String>] [-purchase_order <String>] [-license_name <String>] [-license_email <MailAddress>]
|
||||||
[-manufacturer_id <Int32>] [-supplier_id <Int32>] [-depreciation_id <Int32>] [-category_id <Int32>]
|
[-manufacturer_id <Int32>] [-supplier_id <Int32>] [-depreciation_id <Int32>] [-category_id <Int32>]
|
||||||
[-order <String>] [-sort <String>] [-limit <Int32>] [-offset <Int32>] [-all] -url <String> -apiKey <String>
|
[-order <String>] [-sort <String>] [-limit <Int32>] [-offset <Int32>] [-all] [-url <String>]
|
||||||
[<CommonParameters>]
|
[-apiKey <String>] [<CommonParameters>]
|
||||||
```
|
```
|
||||||
|
|
||||||
### Get with ID
|
### Get with ID
|
||||||
```
|
```
|
||||||
Get-SnipeitLicense [-id <Int32>] -url <String> -apiKey <String> [<CommonParameters>]
|
Get-SnipeitLicense [-id <Int32>] [-url <String>] [-apiKey <String>] [<CommonParameters>]
|
||||||
```
|
```
|
||||||
|
|
||||||
### Get licenses checked out to user ID
|
### Get licenses checked out to user ID
|
||||||
```
|
```
|
||||||
Get-SnipeitLicense [-user_id <Int32>] [-all] -url <String> -apiKey <String> [<CommonParameters>]
|
Get-SnipeitLicense [-user_id <Int32>] [-all] [-url <String>] [-apiKey <String>] [<CommonParameters>]
|
||||||
```
|
```
|
||||||
|
|
||||||
### Get licenses checked out to asset ID
|
### Get licenses checked out to asset ID
|
||||||
```
|
```
|
||||||
Get-SnipeitLicense [-asset_id <Int32>] [-all] -url <String> -apiKey <String> [<CommonParameters>]
|
Get-SnipeitLicense [-asset_id <Int32>] [-all] [-url <String>] [-apiKey <String>] [<CommonParameters>]
|
||||||
```
|
```
|
||||||
|
|
||||||
## DESCRIPTION
|
## DESCRIPTION
|
||||||
|
|
@ -69,14 +69,15 @@ Accept wildcard characters: False
|
||||||
```
|
```
|
||||||
|
|
||||||
### -apiKey
|
### -apiKey
|
||||||
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead.
|
||||||
|
Users API Key for Snipeit.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
Type: String
|
Type: String
|
||||||
Parameter Sets: (All)
|
Parameter Sets: (All)
|
||||||
Aliases:
|
Aliases:
|
||||||
|
|
||||||
Required: True
|
Required: False
|
||||||
Position: Named
|
Position: Named
|
||||||
Default value: None
|
Default value: None
|
||||||
Accept pipeline input: False
|
Accept pipeline input: False
|
||||||
|
|
@ -356,14 +357,15 @@ Accept wildcard characters: False
|
||||||
```
|
```
|
||||||
|
|
||||||
### -url
|
### -url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead.
|
||||||
|
URL of Snipeit system.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
Type: String
|
Type: String
|
||||||
Parameter Sets: (All)
|
Parameter Sets: (All)
|
||||||
Aliases:
|
Aliases:
|
||||||
|
|
||||||
Required: True
|
Required: False
|
||||||
Position: Named
|
Position: Named
|
||||||
Default value: None
|
Default value: None
|
||||||
Accept pipeline input: False
|
Accept pipeline input: False
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
external help file: SnipeitPS-help.xml
|
external help file: SnipeitPS-help.xml
|
||||||
Module Name: SnipeitPS
|
Module Name: snipeitps
|
||||||
online version:
|
online version:
|
||||||
schema: 2.0.0
|
schema: 2.0.0
|
||||||
---
|
---
|
||||||
|
|
@ -14,7 +14,7 @@ Gets a list of Snipe-it Licenses Seats or specific Seat
|
||||||
|
|
||||||
```
|
```
|
||||||
Get-SnipeitLicenseSeat [-id] <Int32> [[-seat_id] <Int32>] [[-limit] <Int32>] [[-offset] <Int32>] [-all]
|
Get-SnipeitLicenseSeat [-id] <Int32> [[-seat_id] <Int32>] [[-limit] <Int32>] [[-offset] <Int32>] [-all]
|
||||||
[-url] <String> [-apiKey] <String> [<CommonParameters>]
|
[[-url] <String>] [[-apiKey] <String>] [<CommonParameters>]
|
||||||
```
|
```
|
||||||
|
|
||||||
## DESCRIPTION
|
## DESCRIPTION
|
||||||
|
|
@ -45,14 +45,15 @@ Accept wildcard characters: False
|
||||||
```
|
```
|
||||||
|
|
||||||
### -apiKey
|
### -apiKey
|
||||||
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead.
|
||||||
|
Users API Key for Snipeit.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
Type: String
|
Type: String
|
||||||
Parameter Sets: (All)
|
Parameter Sets: (All)
|
||||||
Aliases:
|
Aliases:
|
||||||
|
|
||||||
Required: True
|
Required: False
|
||||||
Position: 6
|
Position: 6
|
||||||
Default value: None
|
Default value: None
|
||||||
Accept pipeline input: False
|
Accept pipeline input: False
|
||||||
|
|
@ -122,14 +123,15 @@ Accept wildcard characters: False
|
||||||
```
|
```
|
||||||
|
|
||||||
### -url
|
### -url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead.
|
||||||
|
URL of Snipeit system.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
Type: String
|
Type: String
|
||||||
Parameter Sets: (All)
|
Parameter Sets: (All)
|
||||||
Aliases:
|
Aliases:
|
||||||
|
|
||||||
Required: True
|
Required: False
|
||||||
Position: 5
|
Position: 5
|
||||||
Default value: None
|
Default value: None
|
||||||
Accept pipeline input: False
|
Accept pipeline input: False
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
external help file: SnipeitPS-help.xml
|
external help file: SnipeitPS-help.xml
|
||||||
Module Name: SnipeitPS
|
Module Name: snipeitps
|
||||||
online version:
|
online version:
|
||||||
schema: 2.0.0
|
schema: 2.0.0
|
||||||
---
|
---
|
||||||
|
|
@ -15,12 +15,12 @@ Gets a list of Snipe-it Locations
|
||||||
### Search (Default)
|
### Search (Default)
|
||||||
```
|
```
|
||||||
Get-SnipeitLocation [-search <String>] [-order <String>] [-limit <Int32>] [-offset <Int32>] [-all]
|
Get-SnipeitLocation [-search <String>] [-order <String>] [-limit <Int32>] [-offset <Int32>] [-all]
|
||||||
-url <String> -apiKey <String> [<CommonParameters>]
|
[-url <String>] [-apiKey <String>] [<CommonParameters>]
|
||||||
```
|
```
|
||||||
|
|
||||||
### Get with ID
|
### Get with ID
|
||||||
```
|
```
|
||||||
Get-SnipeitLocation [-id <Int32>] -url <String> -apiKey <String> [<CommonParameters>]
|
Get-SnipeitLocation [-id <Int32>] [-url <String>] [-apiKey <String>] [<CommonParameters>]
|
||||||
```
|
```
|
||||||
|
|
||||||
## DESCRIPTION
|
## DESCRIPTION
|
||||||
|
|
@ -56,14 +56,15 @@ Accept wildcard characters: False
|
||||||
```
|
```
|
||||||
|
|
||||||
### -apiKey
|
### -apiKey
|
||||||
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead.
|
||||||
|
Users API Key for Snipeit.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
Type: String
|
Type: String
|
||||||
Parameter Sets: (All)
|
Parameter Sets: (All)
|
||||||
Aliases:
|
Aliases:
|
||||||
|
|
||||||
Required: True
|
Required: False
|
||||||
Position: Named
|
Position: Named
|
||||||
Default value: None
|
Default value: None
|
||||||
Accept pipeline input: False
|
Accept pipeline input: False
|
||||||
|
|
@ -148,14 +149,15 @@ Accept wildcard characters: False
|
||||||
```
|
```
|
||||||
|
|
||||||
### -url
|
### -url
|
||||||
URL of Snipeit system, can be set using Set-SnipeitInfoeItInfo command
|
Deprecated parameter, please use Connect-SnipeitPS instead.
|
||||||
|
URL of Snipeit system.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
Type: String
|
Type: String
|
||||||
Parameter Sets: (All)
|
Parameter Sets: (All)
|
||||||
Aliases:
|
Aliases:
|
||||||
|
|
||||||
Required: True
|
Required: False
|
||||||
Position: Named
|
Position: Named
|
||||||
Default value: None
|
Default value: None
|
||||||
Accept pipeline input: False
|
Accept pipeline input: False
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue