Hi,
I am developing an application which will use a query command to display all the sessions logged into win2k server. My code is as shown below:
%@ language="vbscript" %>
<%
Response.Write "<script type=text/javascript language=javascript src=top_nav1.
js></script>"
dim x(50),i,count,j,serv
i = 0
j = 0
Set objShell = CreateObject("WScript.Shell")
Set objWshScriptExec = objShell.Exec("cmd /c query user /server:")//put the server name
Set objStdOut = objWshScriptExec.StdOut
Set objShell = Nothing
While Not objStdOut.AtEndOfStream
strLine = objStdOut.ReadLine
strLine = Wscript.Stdout.ReadLine
strLine = strLine & vbCRLF
x(i) = Trim(Mid(strLine,42,3))
if j = 0 then
response.write "<pre>" & strLine & "</pre>"
response.write ""
else
response.write "<pre>" & strLine & "</pre>"
response.write "<b><a href=TERMINATETS001.asp?mode="& x(j) &"> Disconnected </a></b>"
response.write ""
end if
i = i + 1
j = j + 1
Wend
Response.Write "<center><script type=text/javascript language=javascript src=bottom_nav.
js></script></center>"
%>
The above script works for Terminal server, but when i am trying to run the same script to display sessions of win2K server running active directory. It doesnt display the sessions. If, same script is executed from win2k server itself, it works properly. I have also checked that command which i am passing in exec method is perfect. When you run the same command from dos prompt it will display sessions of remote win2k server. I have also ensured that i have admin rights. Can you please help me as i am stuck here since last week without luck.
Thanks