Skip to content

Return MAC Address (custom fieldset) with "Get-SnipeITAsset -status 'Deployed'" #297

@stephecannon

Description

@stephecannon

I am attempting to get all assets with a status of "Deployed" and return a custom field (MAC Address) with the result (to later be ingested by my Network Access Control system).

It appears that the "-customfields" flag wants a hashtable...?

I can understand the need for a hashtable in the set-snipeitasset command because you want to set the custom field to a value, but I am failing to understand how the command could be used to return the custom field value.

Is this an error or am I missing something?

Your Environment

  • SnipitPS Module version used: 1.10.227
  • Operating System and PowerShell version: Windows 11 / Powershell 7.3.2
  • Snipe It version: v6.0.10

Expected Behavior

I would expect to use the Get-SnipeITAsset command like this:
get-snipeitasset -status 'Deployed' -cusomfields 'MAC Address'

Current Behavior

get-snipeitasset -status 'deployed' -customfields 'MAC Address'
Get-SnipeitAsset: Cannot process argument transformation on parameter 'customfields'. Cannot convert the "MAC Address" value of type "System.String" to type "System.Collections.Hashtable".

Possible Solution

I'm good with formatting my custom field request as a hashtable, but as I am expecting to receive a variable I would expect the value to be empty.

Steps to Reproduce (for bugs)

  1. Open Powershell
  2. Have your url and api key established in your script
  3. In powershell "Import-Module SnipeitPS" then "Connect-SnipeitPS -URL 'https://YOUR.url' -apiKey $APIKey"
  4. Then in powershell "Get-SnipeitAsset -status "Ready to Deploy" -customfields 'MAC Address'''

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