I m new to ASP 'n' this forum also.
I m writing one code to invoke remote desktop service for given IP address. For that i m using mstsc.exe file to invoke RDP.
I have a no of links to be displayed on the page and on click of link, RDP for that IP should be called.
Currently i m using one button to invoke RDP.
But i m doing some mistake. here is my code:
serverlist.txt file just contains the username and corrosponding IP addresses.
Expand|Select|Wrap|Line Numbers
- <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001" %>
- <%
- '' To Get Server List into Array corrosponding to particular User
- Dim ForReading
- ForReading = 1
- Dim list()
- Dim l
- Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
- Set objTextFile = objFSO.OpenTextFile _
- ("C:\ServerList.txt", ForReading)
- Do Until objTextFile.AtEndOfStream
- strNextLine = objTextFile.Readline
- arrServiceList = Split(strNextLine , ",")
- if arrServiceList(0)="anu" then
- l= Ubound(arrServiceList)
- Redim list(l)
- For i = 1 to Ubound(arrServiceList)
- list(i-1)=arrServiceList(i)
- Next
- end if
- Loop
- %>
- <%
- Dim objFS, objLogFile, fo
- Dim strLogFilename
- strLogFilename = "testrun.log"
- Set objFS = CreateObject("Scripting.FileSystemObject")
- Set fo=objFS.GetFolder("c:\test")
- Set objLogFile=fo.CreateTextFile(strLogFilename,true)
- objLogFile.writeLine "starts now "
- public function runfile()
- objLogFile.writeLine "in run"
- dim wshell
- set wshell=CreateObject("WScript.Shell")
- objLogFile.writeLine "Object created"
- call wshell.run ("C:\windows\system32 \mstsc.exe /v:172.20.31.102")
- objLogFile.writeLine "after run"
- set wshell=nothing
- End function
- %>
- <html>
- <HEAD>
- <TITLE></TITLE>
- </HEAD>
- <body>
- <TABLE width="100%" height="100%">
- <% For i = 0 to Ubound(list)-1 %>
- <tr>
- <td>
- <a href="#"> <img src="images\AppIcons\TerminalServices.gif"> <% =list(i) %> </a>
- </td>
- </tr>
- <% Next %>
- <tr>
- <td>
- <input type="button" value="click me" name="sub" onClick="<%runfile()%>" />
- </td>
- </tr>
- </Table>
- </body>
- </html>
I have inserted one button. i want to call runfile() function to be called on click event of that button.
For testing purpose i m writing into logfile in runfile() function.
The problem is:
1. when i browse this page , at the same time it call the
runfile() function 'n' write entries into file.
2. on click of button, the function is not getting called.
3. wshell.run ("C:\windows\system32 \mstsc.exe /v:172.20.31.102") is not executing. The syntax is correct( i m sure abt the syntax)
mstsc.exe file is on server side. i want it to execute from client side 'n' it should invoke RDP for the client.
Please help me in this issue.
I m trying from last 2 days.
I need it urgently
Thanks in advance.
Anu