Such a script would have to go into a logon script.
But there are a couple of questions to be answered, the more important one being the one on security.
A logon script runs normally under the user's credentials, which means the user would need to have the authority to cancel open sessions.
With the later Horizon View module, you at least can connect from anywhere, no more need to run such a script on a Connection Server.
But afaik, there are no examples of such a script in the wildBlog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
I can see how this script could be created but like Luc says the user would need to have rights in the horizon admin which is someting I am totally against. then there is the fact that the module for view doesn't accept current credentials so a password file needs to be created for each user or everytime they login they need to give their credentials a 2nd time which is bad as well.
Can you please give the use case for this and what are you trying to solve exactely?
In another topic I have created a script for admins to remove single desktops in certain error states maybe this helps you from the admin side of things.