Automating the World

 
User avatar
DarrenWhite99
Geek
Topic Author
Posts: 415
Joined: Wed Jun 04, 2014 11:17 pm
Current LT Agent Count: 1500+
Location: Redding, California, US

Fun with Session Filters and Subgroup Expressions

Wed Aug 09, 2017 3:44 am

Some of these are in the examples/help inside Control, but still....

Session Filters
(GuestClientVersion <> $SERVERVERSION)    -  Show agents that are not on the current version.

CustomProperty1='XXXX'        - Show agents for Client XXXX

These can be combined with AND (or OR, NOT). For the full reference, see https://docs.connectwise.com/ConnectWise_Control_Documentation/Get_started/Host_page/Session_groups/Session_groups_filter_reference

Subgroups Expressions:
CustomProperty1    - If using the CWAutomate Plugin, should be populated with the Client Name. Groups agents by Client.

IIF(GuestConnectedCount > 0, 'Connected', 'Disconnected')    - Groups agents into "Connected" and "Disconnected". Could also be "Online Now"/"Offline", etc.

GuestClientVersion     - Groups agents by their version number.

IIF(GuestConnectedCount > 0, 'Online Now', 'During ' + IIF(SUBSTRING(CONVERT(LastEventTime,System.String),1,1) IN ('11','12'), SUBSTRING(CONVERT(LastEventTime,System.String),1,2) + IIF(SUBSTRING(CONVERT(LastEventTime,System.String),6,1)='/', SUBSTRING(CONVERT(LastEventTime,System.String),6,5), SUBSTRING(CONVERT(LastEventTime,System.String),5,5)), SUBSTRING(CONVERT(LastEventTime,System.String),1,1) + IIF(SUBSTRING(CONVERT(LastEventTime,System.String),5,1)='/', SUBSTRING(CONVERT(LastEventTime,System.String),5,5), SUBSTRING(CONVERT(LastEventTime,System.String),4,5))))                - Groups agents into "Online Now", or the Month/Year that they were last connected.

You can combine and list these in any order, comma separated. For Example, one Subgroup Expression I use is:
CustomProperty1,IIF(GuestConnectedCount > 0, 'Connected', 'Disconnected'),GuestClientVersion
To convert a date or a number into a string, use: CONVERT(LastEventTime,System.String) - LastEventTime is a Date/Time value.
 
User avatar
DarrenWhite99
Geek
Topic Author
Posts: 415
Joined: Wed Jun 04, 2014 11:17 pm
Current LT Agent Count: 1500+
Location: Redding, California, US

Re: Fun with Session Filters and Subgroup Expressions

Wed Aug 09, 2017 9:16 pm

This tip from @imurphy on Slack!

To select only agents with outdated software versions, In the session filter put:
(GuestClientVersion <> $SERVERVERSION) and (GuestClientVersion <> '')

In Subgroup expressions, try
IIF(GuestConnectedCount > 0, substring(Name,1,1), 'Offline')
It should return a table of online machines grouped by the first letter of their hostname, with a final group for offline agents.

Thanks @imurphy!
 
SteveIT
Posts: 12
Joined: Wed Jun 29, 2016 10:02 am
Current LT Agent Count: 1500+
Contact:

Re: Fun with Session Filters and Subgroup Expressions

Thu Aug 10, 2017 10:19 am

This is great and something I've needed for some time.

I now have a simple summary of all agents that are out of date for pretty easy remediation, and with guestclientversion grouping, agents that are offline/old/retired that were never cleaned up show up as a grouping of version 'none' which makes for easy removal!

Session filter
(GuestClientVersion <> $SERVERVERSION)
Expression
GuestClientVersion

I added a simple 'Active Sessions' view with session filter HostConnectedCount > 0, but would be nice to see agents with active host sessions in last 24 hours.
 
SteveIT
Posts: 12
Joined: Wed Jun 29, 2016 10:02 am
Current LT Agent Count: 1500+
Contact:

Re: Fun with Session Filters and Subgroup Expressions

Thu Aug 10, 2017 2:58 pm

http://product.screenconnect.com/topics ... variables/
Feature request for LastHostConnectedEventTime - please vote to get this added!