Reporting a count of machines in a collection.
I have an auto report setup that will check a pair of collections and then this report is emailed to myself and a couple of other people in the department including the manager. The manager wants to know what the total number of machines in the collections is as well as those in the report. While I could just have a report pull the entire collection and email that alongside the filtered report, that seems rather messy. Just including the total machine count from the collection as part of the body of the email in the auto report would suffice, but I think I'll have to set up a custom variable for this and I'm not sure how to best go about it.
Comments
A custom variable is probably the best way to go like you said, but unfortunately PDQ doesn't let you use insert statements in reports so you can't update the variable as a part of the report itself. You could, however, run a regular task to update the custom variable with a bit of PowerShell.
PDQInventory GetCollectionComputers $collectionNamewill get you list of the computers in a collection, and you can grab the length of that list to get a count on how many computers are in it. Then update the variable withPDQInventory UpdateCustomVariableand you'll end up with something like this that you can run just before your auto report kicks off, and reference the variable in the email like normal.pdqinventory updatecustomvariable $targetVariable (PDQInventory GetCollectionComputers $collectionName).Length