views:

310

answers:

1

Hi, I'm trying to write a small app which can be used in order to log off Citrix Sessions. Citrix Sessions can be logged off via cmd or a batch file using this method:

@echo off
echo "Enter username"
set /p UserName=

echo 001
query user %username% /server:server1
echo 002
query user %username% /server:server2
echo 003
query user %username% /server:server3

etc etc

This would give me the following results:

001
No User exists for Charlie
002
No User exists for Charlie
003
 USERNAME            SESSIONNAME         ID   STATE   IDLE TIME  LOGON TIME
 Charlie             ica-tcp#32           6   Active          .  29.01.2010 13:23

So basically what I want to do is to select each listbox item that matches one of the hits from the cmd command. Probably the servername that gives a different result than "No User exists for"

How can something like this be achieved?

+1  A: 

You can loop through the listbox items and check if the current item name is equal to your string, if true set the SelectedIndex to the current loop var(probably i). Hope I understood your question

Adir
Yes you did. So this means that I should do a "For each" loop to check if the strings corespond? Ok, do you know by any chance how I also can pick up a string from a cmd command as well?Would I have to write the output to a textfile and then read that textfile?
Kenny Bones
Nevermind, found out about the For Environment.GetCommandLineArgs()
Kenny Bones