mirror of
https://github.com/snazy2000/SnipeitPS.git
synced 2025-12-13 18:02:30 +00:00
Changes to fix changes in newer build
This commit is contained in:
parent
ebb99a24fa
commit
cf23662a42
2 changed files with 18 additions and 3 deletions
|
|
@ -62,12 +62,16 @@ function New-Asset()
|
||||||
)
|
)
|
||||||
|
|
||||||
$Values = @{
|
$Values = @{
|
||||||
"asset_tag" = $tag
|
|
||||||
"name" = $Name
|
"name" = $Name
|
||||||
"status_id" = $status_id
|
"status_id" = $status_id
|
||||||
"model_id" = $model_id
|
"model_id" = $model_id
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('tag'))
|
||||||
|
{
|
||||||
|
$Values += @{"asset_tag" = $tag}
|
||||||
|
}
|
||||||
|
|
||||||
if ($customfields)
|
if ($customfields)
|
||||||
{
|
{
|
||||||
$Values += $customfields
|
$Values += $customfields
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,10 @@ function Set-AssetOwner()
|
||||||
[int]$id,
|
[int]$id,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $true)]
|
||||||
[int]$user_id,
|
[int]$assigned_id,
|
||||||
|
|
||||||
|
[ValidateSet("location","asset","user")]
|
||||||
|
[string] $checkout_to_type = "user",
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $true)]
|
||||||
[string]$url,
|
[string]$url,
|
||||||
|
|
@ -20,7 +23,15 @@ function Set-AssetOwner()
|
||||||
)
|
)
|
||||||
|
|
||||||
$Values = @{
|
$Values = @{
|
||||||
"user_id" = $user_id
|
"id" = $assigned_id
|
||||||
|
"checkout_to_type" = $checkout_to_type
|
||||||
|
}
|
||||||
|
|
||||||
|
switch ($checkout_to_type)
|
||||||
|
{
|
||||||
|
'location' { $Values += @{ "assigned_location" = $assigned_id } }
|
||||||
|
'user' { $Values += @{ "assigned_user" = $assigned_id } }
|
||||||
|
'asset' { $Values += @{ "assigned_asset" = $assigned_id } }
|
||||||
}
|
}
|
||||||
|
|
||||||
$Body = $Values | ConvertTo-Json;
|
$Body = $Values | ConvertTo-Json;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue