Thanks Luc
That is a useful variable! That does indeed help disconnect old sessions, but I now get an odd exception if I specify the right VC to login to, but enter my credentials incorrectly - well this first exception is normal, and the script/GUI exits, but upon on the next login, no matter if I put the right VC servername in or not, I get an exception saying:
the argument is null or empty. Supply an argument that is not null or empty and then try the command again
I am using a Try...Catch for displaying the login form asking for the VC name/IP. The Catch is where I get this exception caught. Any ideas? I checked the VC sessions area and when this happens I have no other sessions logged in, apart from the account actually viewing the sessions in the vSphere client. (this session).
Here is the exception that it gets (you can see abit of the script in the background for the try...catch): http://dl.dropbox.com/u/450727/exception-eg.jpg