Custom Fields
Record your own device attributes, things Pckgr does not collect on its own, such as which EDR agent is installed, whether Windows Hello is enabled, or the list of local administrators. A short script you write finds the answer on every Windows device, and the results become values you can sort, filter and build dynamic groups on.
In short
- Define a field, write a collector script that reports it with one helper call, and mark the script as a collector.
- No scripting experience? Create with AI writes the fields and the script from a plain-English description, for you to review.
- Collectors run on every Windows device on the cadence you choose. They are not scheduled against groups.
- Only the latest value per device is kept.
- Values show on the device page, as Devices list columns, and as attributes in dynamic group rules.
- A field's key is fixed once created; its name, description and type can change.
How it works
Define a field on the Custom Fields tab of the Scripts page.
A field has a name, a key and a type.Write a collector script that finds the value and reports it with a one-line helper.
Mark the script as a collector on the Scripts page and choose how often it runs.
Every Windows device runs it on its next check-in, then again on the cadence you chose.
Values appear on the device detail page, as optional columns on the Devices list, and as attributes in the group rule builder.
Only the latest value per device is kept.
Windows only
Create a field with AI
If you do not write PowerShell, describe what you want to know and let AI write the fields and the collector script. Nothing is saved until you have reviewed it.
Go to Scripts in the sidebar and open the Custom Fields tab.
Click Create with AI.
Describe what you want to know about each device in plain words.
For example "Which antivirus or EDR is installed, and is it running?" or "How many local administrators are there, and who are they?". Ask one question at a time.Click Write Script.
This usually takes a minute or two.Review the draft.
Tick I have read this script and click Create Fields and Collector.
- Fields
- The fields the script fills in. You can rename a new field or change its type. A field you already have is reused and marked Existing field.
- Check these before saving
- Shown when Pckgr’s own check of the script finds something a collector should not do, such as changing settings, deleting files or contacting the internet. Do not save a script with a warning you do not understand.
- Collector script
- The PowerShell itself, with a short explanation above it and notes on its assumptions below. You can edit it.
- Runs as, How often, Script name
- Chosen for you; change them if you need to.
The fields and the collector are created exactly as if you had made them by hand: the script appears in the Windows tab with Collect custom fields turned on and a comment at the top saying it was drafted with AI. Force a check-in on one device to see the first values.
- If the request is not something a collector can report (for example "uninstall Chrome" or "show the BitLocker recovery key"), the dialog says so instead of writing a script.
- Your description and the names of your existing custom fields are sent to Pckgr's AI provider to write the draft. No device data is sent. Each request is recorded in the audit log.
AI makes mistakes
Define a field
Go to Scripts in the sidebar and open the Custom Fields tab.
Click New Field.
Fill in the fields below.
Click Create Field.
- Name
- The label shown in the portal, for example “EDR Type”.
- KeyCannot be changed later
- The identifier your script uses, for example
edr_type. Suggested from the name; must start with a letter and contain only lowercase letters, digits and underscores. - TypeText, Number, Yes / No or Date
- Reported values that do not match the type are rejected and shown as an error on the device. Can be changed later; see Change a field's type.
- Description
- Optional.
You can rename a field, edit its description or change its type at any time. The field list shows how many devices have a value and how many devices' last report was rejected. Click the list icon on a row to see the current value on every device.
Warning
Change a field's type
The key is fixed once a field exists, because your scripts refer to it. The type is not. Open the field with the pencil icon and pick a new type; before you save, the dialog shows what the change does to the values already collected:
- Values that read as the new type are converted and kept.
1,024in a Text field becomes the number1024, the number1becomes Yes, and2026-09-15becomes a date. - Values that do not read as the new type (for example
SentinelOnein a field you change to Number) are marked with an error on the device until the next collector run replaces them. A number is never read as a date. - Devices whose last report was already rejected stay empty until the next collector run.
- Dynamic groups with a rule on the field are re-evaluated immediately, because the rule now compares under the new type.
The change is recorded in the audit log with the number of values converted and invalidated.
A date collected into a Text field is the common reason to do this. Stored as Text, it is displayed exactly as the script reported it (for example 2026-09-15T06:05:10.3593250Z) and compares as text rather than chronologically. Change the field to Date and the stored timestamps convert in place.
Check rules on the field afterwards
2026-09-15 matches a Date field and not the same value stored as Text.Write a collector script
A collector is an ordinary PowerShell script. The only rule is that it reports values with the helper Pckgr provides. The helper is available automatically inside collector scripts; you do not define it yourself, and there is nothing to paste into the portal.
Set-PckgrField -Name <key> -Value <value>Call the helper once per field. A single script can set as many fields as you like. Keys are not case-sensitive, so edr_type and EDR_Type reach the same field. Values are sent as text and converted to the field's type on the server:
| Type | Accepted values |
|---|---|
| Text | Anything, up to 4096 characters |
| Number | Any number, for example 42, 3.5, 1,024 |
| Yes / No | true/false, yes/no, 1/0, on/off, or a PowerShell boolean |
| Date | An ISO-8601 date or date-time, for example 2026-09-15 or 2026-09-15T10:30:00Z |
An empty value clears the field on that device.
On a current agent, your script runs on the device unchanged from its own file, with the helper supplied by a signed runner script installed with the agent, so a collector you sign with your own certificate keeps its signature (see Hardened Environments). Older agents add the helper to the top of the file before running it.
Example: EDR type and health
Define two fields first: edr_type (Text) and edr_healthy (Yes / No). Then upload this script as a collector:
# Detects which EDR agent is present and whether its service is running.
# [ordered] matters: a plain hashtable enumerates in no guaranteed order,
# so Defender could win over a third-party agent.
$known = [ordered]@{
SentinelAgent = 'SentinelOne'
CSFalconService = 'CrowdStrike Falcon'
SAVService = 'Sophos'
WinDefend = 'Microsoft Defender'
}
$type = 'None'
$healthy = $false
foreach ($service in $known.Keys) {
$svc = Get-Service -Name $service -ErrorAction SilentlyContinue
if ($svc) {
$type = $known[$service]
$healthy = ($svc.Status -eq 'Running')
if ($service -ne 'WinDefend') { break } # prefer a third-party agent over Defender
}
}
Set-PckgrField -Name edr_type -Value $type
Set-PckgrField -Name edr_healthy -Value $healthyMark a script as a collector
Go to Scripts and either create a new script or open an existing one.
Turn on Collect custom fields.
The toggle is only offered for PowerShell scripts.Choose how often it runs: Every hour, Every 4 hours, Every 12 hours, Daily or Weekly.
Save.
- Collectors are not scheduled against groups. They run on every Windows device.
- A collector only runs when the device is otherwise idle, so it never competes with an app install.
- Turning the toggle off stops future runs but keeps the values already collected.
Test a new collector quickly
Where values appear
- Device detail page
- The Custom Fields card on the device's Overview tab lists every field with its value and when it was collected. Hover the collection time to see the exact time and which script reported it; a rejected value shows its error in red. Manage on the card opens the Custom Fields tab.
- Devices list
- Click Columns above the table to add custom fields as columns. Your choice is remembered in the browser. The search box matches every custom field value, shown as a column or not, and Filter narrows the list by a field.
- Custom Fields tab (Scripts page)
- The list icon on a field shows its value on every device.
Use custom fields in dynamic groups
When you create a group or edit its rules, the rule builder offers every custom field alongside the built-in attributes (Hostname, OS Version, Platform, Manufacturer, Model, Last logged-on user, Encryption status and Entra join type). For a custom field, the operators depend on the field's type:
| Type | Operators |
|---|---|
| Text | Equals, Not Equals, Contains, Not Contains, Starts With, Does Not Start With, Ends With, Does Not End With, Is Empty, Is Not Empty |
| Number, Date | Equals, Not Equals, Greater Than, Greater Than Or Equal, Less Than, Less Than Or Equal, Is Empty, Is Not Empty |
| Yes / No | Is True, Is False, Is Empty, Is Not Empty |
- A device must match all of a group's rules to be a member; there is no "any of" option, so "EDR is Sophos or missing" needs two groups.
- "Is Empty" matches devices that have never reported the field as well as devices whose last report was rejected.
When membership is recalculated
Membership is not a one-off check at creation. A device is re-evaluated:
- When the group is created or its rules are saved, against every device in the tenant, so a new group is populated immediately.
- Every time the device checks in, roughly every five minutes.
- Every time a collector reports values for that device, so a changed field moves the device in or out of groups in the same cycle.
- When the device enrolls, so a new device lands in the right groups before its first check-in.
Devices that join a group receive that group's app assignments automatically, which is what turns a collected fact ("EDR type is None") into an action (install the EDR agent). Leaving a group stops future assignments and cancels deployments it queued that have not started yet, but does not uninstall anything already deployed.
Troubleshooting
If no values are appearing, open the collector script and check the Collector Runs card. Each device shows its last run time, status, exit code, how many fields it set, and any problem.
| What you see | Cause and fix |
|---|---|
| Unknown field key(s) | The script set a key that is not defined under Custom Fields. Check the spelling; case does not matter. |
| The script completed but did not set any fields | The script ran but never called the helper. Make sure you are using Set-PckgrField, not just printing the value. |
| Deferred | A User-context collector ran while nobody was logged in. It retries within the hour. |
| Nothing in the runs list | Devices pick up a new collector on their next check-in, which can take a few minutes; force a check-in to run it now. The device must be running an agent version that supports collectors. Older agents ignore them and never appear in the runs list. |
| A field shows an error instead of a value | The reported value could not be converted to the field's type, for example the text Enabled in a Number field. The error is shown in place of the value in the Custom Fields card on the device's Overview tab. Fix the script, or if the type was wrong, edit the field and change its type; values that read as the new type are converted in place. |
| A date shows as a long raw timestamp | The field was created as Text rather than Date, so the value is stored exactly as reported. Edit the field and change its type to Date; the stored timestamps convert in place. |
| A group rule never matches | Check that the rule's value matches the normalized form: Yes / No fields store true or false, dates are compared as dates, and text comparisons ignore case. |
Tips for collectors
- Keep collectors fast and read-only. They run on every device, so a slow or destructive script is felt fleet-wide.
- Use System context unless the value only exists in the logged-in user's profile (browser extensions, for example). A User context collector waits until someone is logged in and retries within the hour if nobody is.
- Normal script output is ignored; only helper calls are recorded. You can leave
Write-Hostdiagnostics in place. - Anything else the script prints is not stored, so a collector cannot leak data into the portal by accident.