Closed OccupiedToast closed 2 years ago
SnipeitPS syntax does not follow data syntax, it's tryin to use anipeit api syntax as close as possible. As checkout and in is using different api endpoints than set-snipeitasset, asset checkout and checkin is done by diffrent commands Set-SnipeitAssetOwner and Reset-SnipeitAssetOwner . (where those strange command names came from, I don't know, they were already named like that when I arrived here. :) )
No activity, closing this
Thank you very much!
Context
So I'm trying to make a script to bulk checkout items to a specified user as I've heard many people have had issues with that not being a feature in the SnipeIT GUI. When I try to use "Set-SnipeitAsset" to change the "assigned_to" field, I get an error saying that it could not convert the value to type "System.Int32". I was using the commands:
Set-SnipeitAsset -id $id.id -assigned_to id=55
Set-SnipeitAsset -id $id.id -assigned_to 55 (this one kind of worked, it did not throw an error, however in the Snipeit web interface it showed the asset as not being checked out but also not able to be checked out.)
Set-SnipeitAsset -id $id.id -assigned_to "Employee Name" (exact name as shown in Snipeit web interface)
Set-SnipeitAsset -id $id.id -assigned_to @{id=55; username=(username); name=(name); first_name=(first name); last_name=(last name); employee_number=1; type=user}
Your Environment
Expected Behavior
I was expecting it to set the "assigned_to" field to the id number inputted, then I tried copy/pasting the "assigned_to" value from another asset assigned to that user, that also did not work.
Possible Solution
Am I using the command correctly? I am currently using the "id" field as the identifier for which asset to make changes to, any fields after that should, in my mind, change properties of the asset.