mirror of
https://github.com/snazy2000/SnipeitPS.git
synced 2025-12-13 01:42:29 +00:00
64 lines
1.8 KiB
PowerShell
64 lines
1.8 KiB
PowerShell
<#
|
|
.SYNOPSIS
|
|
Get list of checked out accessories
|
|
.DESCRIPTION
|
|
Get list of checked out accessories
|
|
|
|
.PARAMETER id
|
|
Unique ID For accessory to list
|
|
|
|
.PARAMETER url
|
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
|
|
|
.PARAMETER apiKey
|
|
Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit.
|
|
|
|
.EXAMPLE
|
|
Get-SnipeitAccessoryOwner -id 1
|
|
#>
|
|
function Get-SnipeitAccessoryOwner() {
|
|
[CmdletBinding(
|
|
SupportsShouldProcess = $true,
|
|
ConfirmImpact = "Medium"
|
|
)]
|
|
|
|
Param(
|
|
[parameter(mandatory = $true)]
|
|
[int]$id,
|
|
|
|
[parameter(mandatory = $false)]
|
|
[string]$url,
|
|
|
|
[parameter(mandatory = $false)]
|
|
[string]$apiKey
|
|
)
|
|
begin {
|
|
$Parameters = @{
|
|
Api = "/api/v1/accessories/$id/checkedout"
|
|
Method = 'GET'
|
|
}
|
|
|
|
if ($PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) {
|
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
|
}
|
|
|
|
if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$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
|
|
}
|
|
|
|
end {
|
|
# reset legacy sessions
|
|
if ($PSBoundParameters.ContainsKey('url') -and '' -ne [string]$url -or $PSBoundParameters.ContainsKey('apiKey') -and '' -ne [string]$apiKey) {
|
|
Reset-SnipeitPSLegacyApi
|
|
}
|
|
}
|
|
}
|