You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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)
Open Powershell
Have your url and api key established in your script
In powershell "Import-Module SnipeitPS" then "Connect-SnipeitPS -URL 'https://YOUR.url' -apiKey $APIKey"
Then in powershell "Get-SnipeitAsset -status "Ready to Deploy" -customfields 'MAC Address'''
The text was updated successfully, but these errors were encountered:
I did find a route around. Turns out that the customfields were being obscured by the output in powershell of the values returned with the command "get-snipeitasset -status 'Ready to Deploy'"
# Get all equipment that is of status "Ready to Deploy" ...
$ValidDevices = get-snipeitasset -status 'Ready to Deploy'
#Parse the deployed devices for their wired MAC addresses
$ValidWiredMACAddresses = $ValidDevices.custom_fields.'MAC Address'.value
By dumping the output into a object ($ValidDevices) and then parsing that variable, then dumping those values into a new object ($ValidWiredMACAddresses) I was able to get what I wanted.
That said, this is a bit of an "out of the way" method of accomplishing my task assuming that the -customfields flag is there on purpose.
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
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)
The text was updated successfully, but these errors were encountered: