SnipeitPS/SnipeitPS/Public/Set-AssetOwner.psd1
2017-11-19 20:57:27 +00:00

41 lines
748 B
PowerShell

function Set-AssetOwner()
{
[CmdletBinding(
SupportsShouldProcess = $true,
ConfirmImpact = "High"
)]
Param(
[parameter(mandatory = $true)]
[int]$id,
[parameter(mandatory = $true)]
[int]$user_id,
[parameter(mandatory = $true)]
[string]$url,
[parameter(mandatory = $true)]
[string]$apiKey
)
$Values = @{
"user_id" = $user_id
}
$Body = $Values | ConvertTo-Json;
$Parameters = @{
Uri = "$url/api/v1/hardware/$id/checkout"
Method = 'POST'
Body = $Body
Token = $apiKey
}
If ($PSCmdlet.ShouldProcess())
{
$result = Invoke-Method @Parameters
}
return $result
}