I had a customer who was running some expensive script calls in an onPreGet function. Essentially, they were querying an external system and populating Virtual Attribute values in real-time when they were requested. This worked, but it was causing some performance issues when using the Active Roles Synchronization Service and the Active Roles Management Shell: querying objects in bulk fired too many of these real-time queries and caused too much overhead.
This customer really only cared about seeing these values in the Active Roles Web Interface and the Active Roles Console, so I suggested that they filter their calls so that they were only triggered by these clients. The below is what we provided as a Proof of Concept, and it resolved their issue. I thought that this might be of interest to the Community as well.
Title: Determining if a User is using the Active Roles Console or the Active Roles Web Interface using a custom script