qwinsta /server:SERVER_NAME | find /I "Active"
Note that this is just a quick&dirty one-liner which would just spit out every line containing "Active" (in lower or upper case). If you expect user names which contain this string, things are going to be more complicated and require to check the fourth column for the correct "Active" string:
for /F "usebackq tokens=1,2,3,4,5*" %i in (`qwinsta /server:SERVER_NAME ^| find "Active"`) do if "%l" == "Active" ( echo %i %j %k %l %m )
If you need to process single fields of the output anyway, the latter form is preferred as it would expose the fields in the %i
... %m
variables.
But this construct also breaks if you have user names containing spaces. If this is the case, all is lost with qwinsta and you should be looking for a PowerShell function to retreive the user list instead.