Custom Field not populating with [pscustomobject]
Hi Team,
I have a script that returns a True/False value. The script seems to run fine via PDQ, and it does locally, but the corresponding custom field I have in PDQ Inventory isn't being populated. How do I go about troubleshooting this? I'm not sure where to start.
The code is as follows:
[pscustomobject]@{
DataHarverster11Compatible = $DataHarverster11Compatible
}
0
Comments
Are you running this as a PowerShell Scanner?
https://link.pdq.com/docs-PDQInventory?powershell-scanner.htm
I am yes.
New Scanner --> PowerShell --> pointing at the .ps1
The results will show up in the PowerShell tab of the Computer window.
No dice there either. Is there any logging or something I can check?
Did you run the Scan Profile that contains the PowerShell Scanner you created against a target? You'll be able to find some information on the Scans tab.
Yessir, it tells me the scan was successful but nothing in PowerShell and the Custom Field has no value.
The call in my original post, can you confirm this isn't used to populate a corresponding custom field in the actual Custom Field category? Seems I'm misunderstanding something here or the use of custom field is in more than one place, or something?
An there's no logging I can look at to see what's going on?
Ah, have just spotted the drop down list for the various scan profiles. I can see the result in there
Correct. PowerShell Scanners cannot populate Custom Fields. Custom Fields are essentially notes that you have to manually fill in. The only way to interact with them programmatically is by importing a CSV file, either through the GUI or command line. https://link.pdq.com/docs-PDQInventory?importwizard.htm
Sorry, I forgot to mention that dropdown. It's been a while since I've actually used Inventory.
Now that you've found the data and can see that it's returning what you expected, I recommend building Collections and/or Reports. Each PowerShell Scanner gets its own Table, and the names all start with PowerShell.
If I remember correctly, the log will only show up at the top of the PowerShell tab of a computer if the scan failed.
Thanks for clarifying, that all makes sense.