Skip to content
This repository was archived by the owner on Aug 25, 2024. It is now read-only.
This repository was archived by the owner on Aug 25, 2024. It is now read-only.

Updating Asset custom fields #35

@kawhiteMBU

Description

@kawhiteMBU

I want to update the owner field on an asset.
When I run Get-SMAAsset I get this:

id              : 7341
asset_type_id   : 10202
name            : Polycom VVX 411 (PoE)
asset_data_id   : 351
owner_id        : 11450
modified        : 2021-05-04 15:54:43
created         : 2021-03-30 13:36:06
mapped_id       : 0
asset_class_id  : 0
archive         : 
asset_status_id : 493
field_10283     : @{id=11450; user_name=user; email=user@email.com; full_name=User}
field_10284     : Spare
field_10278     : Polycom VVX 411 (PoE)
field_10279     : 4001
field_10280     : 64167fd2854f
field_10281     : Department
field_10285     : 
field_10286     : 
field_10287     : 
asset_type_name : VOIP Phones
location        : @{id=7274; asset_type_id=1; name=Spare; owner_id=0; asset_class_id=11011; asset_status_id=0}
Associations    : {}

The field I need to update is field_10283.
I've tried creating a hash table with the info to be updated but I still get errors.

Powershell shows:

At U:\Documents\WindowsPowerShell\Modules\KaceSMA\2.0.1\private\New-ApiPUTRequest.ps1:29 char:9
         Invoke-RestMethod @IRMSplat
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

KACE Server logs show:

[Tue May 04 15:52:19.012997 2021] [proxy_fcgi:error] [pid 34407:tid 34382394112] [client 127.0.0.1:20597] AH01071: Got error 'PHP message: [2021-05-04 15:52:19 -0400] PHP Warning: preg_match() expects parameter 2 to be string, array given in /kbox/kboxwww/include/RowValues.class.php on line 337\nPHP message: [2021-05-04 15:52:19 -0400] PHP Warning: strcasecmp() expects parameter 1 to be string, array given in /kbox/kboxwww/include/RowValues.class.php on line 337\n'

Any help on how to format the code to update this field is appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions