Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
SHADOWUSER.WBT
AddExtender("WWWTS34I.DLL") #DEFINESUBROUTINE GetUsers() ;Enumerate the session information from each server Sessiont1 = wtsEnumSessions("172.16.5.210") Sessiont2 = wtsEnumSessions("172.16.5.211") Sessiont3 = wtsEnumSessions("172.16.5.212") CurrentInfo = "" ;Find out how many sessions on each machine Count1 = Sessiont1[0] Count2 = Sessiont2[0] Count3 = Sessiont3[0] ;Change format for Session ID ID1 = strReplace(Sessiont1[1], @TAB, ",") ID2 = strReplace(Sessiont2[1], @TAB, ",") ID3 = strReplace(Sessiont3[1], @TAB, ",") ;Change format for Session Name Name1 = strReplace(Sessiont1[2], @TAB, ",") Name2 = strReplace(Sessiont2[2], @TAB, ",") Name3 = strReplace(Sessiont3[2], @TAB, ",") ;Change format for State State1 = strReplace(Sessiont1[1], @TAB, ",") State2 = strReplace(Sessiont2[3], @TAB, ",") State3 = strReplace(Sessiont3[3], @TAB, ",") ;Loop through servers getting Usernames For x = 1 to 3 ;Check each session for a user For y = 1 to (Count%x%) State = ItemExtract(y,State%x%,",") ;IF State == "CONNECTED" || State == "ACTIVE" then ID = ItemExtract(y,ID%x%,",") Result = wtsQuerySessionInfo("AFE-TS%x%", ID) ;Get the username UserName = Result[14] if UserName <> "" then If CurrentInfo == "" then CurrentInfo = strCat(UserName, ",", ID, ",", "AFE-TS%x%") Else CurrentInfo = strCat(CurrentInfo,@TAB, UserName, ",", ID, ",", "AFE-TS%x%") Endif Endif ;Endif Next Next CurrentInfo = ItemSort(CurrentInfo, @TAB) ;Set the information in the list DialogControlSet(Handle,5,5,CurrentInfo) #ENDSUBROUTINE #DEFINESUBROUTINE Shadow(Handle,DialogMessage,ControlNum,param4,param5) switch (DialogMessage) case 0 DialogProcOptions(Handle, 2,13) GetUsers() Break case 2 ;Exit the program If ControlNum == 2 then Return 0 Break Endif ;Shadow the user If ControlNum == 1 then User = DialogControlGet(Handle, 5, 6) If User <> "" then ID = ItemExtract(2,User,",") TS = ItemExtract(3,User,",") commandline = strCat(ID, " /SERVER:",TS) Run("SHADOW", commandline) Endif Endif ;Refresh If ControlNum == 3 then GetUsers() Endif Break endswitch return -2 #ENDSUBROUTINE MyDialogFormat=`WWWDLGED,6.1` MyDialogCaption=`Shadow Console` MyDialogX=-1 MyDialogY=-1 MyDialogWidth=212 MyDialogHeight=155 MyDialogNumControls=006 MyDialogProcedure='Shadow' MyDialogFont=`DEFAULT` MyDialogTextColor=`DEFAULT` MyDialogBackground=`DEFAULT,DEFAULT` MyDialogConfig=0 MyDialog001=`089,137,036,012,PUSHBUTTON,DEFAULT,"Shadow",1,4,32,DEFAULT,DEFAULT,DEFAULT` MyDialog002=`165,137,036,012,PUSHBUTTON,DEFAULT,"Cancel",0,2,DEFAULT,DEFAULT,DEFAULT,DEFAULT` MyDialog003=`127,137,036,012,PUSHBUTTON,DEFAULT,"Refresh",2,5,DEFAULT,DEFAULT,DEFAULT,DEFAULT` MyDialog004=`009,005,152,012,STATICTEXT,DEFAULT,"Available Users for Shadowing",DEFAULT,1,DEFAULT,"Microsoft Sans Serif|6656|70|34","0|0|0",DEFAULT` MyDialog005=`007,019,194,102,ITEMBOX,ShadowUsers,DEFAULT,DEFAULT,2,DEFAULT,DEFAULT,DEFAULT,DEFAULT` MyDialog006=`009,123,192,010,STATICTEXT,DEFAULT,"USE CTRL + * (on keypad) TO END SHADOW",DEFAULT,3,512,"Microsoft Sans Serif|6656|70|34","0|0|0","255|255|255"` ButtonPushed=Dialog("MyDialog",1)
Article ID: W16364
File Created: 2005:02:18:12:20:04
Last Updated: 2005:02:18:12:20:04