Hello to the Genius on this realy great Board,

I must collect Informations from MS-Terminalserver Session to write to a SQL Database.

I Use the WTSManager.dll. But i get no Results from the WTS.Client Section. I think i had an Problem with an array, is this so?. Here is the Code Fragment:

$WTS = CreateObject("WTSManager.Shell")
$tsclientip = $WTS.MyIPAddress
$tsusername = $WTS.MyUserName
$wkstaname = $WTS.MyClientName
$tsclientcount = $WTS.ClientCount
For $i = 1 to $tsclientcount
? $WTS.Clients($i).UserName
? $WTS.Clients($i).BuildNumber
? $WTS.Clients($i).WinStationName
? $WTS.Clients($i).ScreenColorDepth
Next

When i use the Sample Code with VB-Script it Works, here the VB-Code :

Set WTS = Wscript.CreateObject("WTSManager.Shell")
MsgBox "My computer name: " + WTS.MyClientName + Chr(13) + "My IP address: " + WTS.MyIPAddress
S = "Total sessions: " & WTS.ClientCount
for i = 1 to WTS.ClientCount
S = S + Chr(13) + WTS.Clients(i).WinStationName + " User: " + WTS.Clients(i).UserName + " IP: " + WTS.Clients(i).IPAddress
Next
MsgBox S

So can anyone help me?