SnipeitPS/SnipeitPS/Public/Set-AssetOwner.ps1
Stephen Maunder 2c1454b673 Extra checks
2017-11-20 09:12:54 +00:00

41 lines
764 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("ShouldProcess?"))
{
$result = Invoke-Method @Parameters
}
return $result
}