I migrated a web server from IIS 4 to IIS 6. The Windows Scripting
Object, which I was using to copy a file, no longer seems to work. The
script is as follows. It is embedded in an ASP page, which now returns
"The page cannot be displayed" when it hits the WshShell.Run line. The
code in question is as follows:

'Create a file handling object:
Set FileSys = Server.CreateObject("Scripting.FileSystemObject")
FileName = FileSys.GetTempName
'Create a Windows Scripting Host Object -
Set WshShell = Server.CreateObject("WScript.Shell")
'Run this batch file with the WSH object -
ret=WshShell.Run("F:\phonedbapps\NewPic.bat " & strPictureID & " " &
FileName, 1, true)

The batch routine NewPic.bat is run from an IIS directory with execute
permissions:
copy D:\tempwork\tempwork.jpg D:\pictures\%1.jpg

------------------------------------------------------------

I also experimented with using the File System Object from ASP, but it
also returns "The page cannot be displayed" when it hits the line
containing ScriptObject.MoveFile. The code is as follows:

'Create a file handling object:
Const OverwriteExisting = True
Set ScriptObject = Server.CreateObject("Scripting.FileSystemObject")
ScriptObject.MoveFile "//SRV1/tempwork/tempwork.jpq",
"//SRV1/testwork/testwork.jpg"

I'm now stumped and out of ideas.



*** Sent via Developersdex http://www.developersdex.com ***

Re: WSH no longer works from ASP by Roland

Roland
Fri May 27 04:38:40 CDT 2005


"S Lee Madsen" <leeinsac@yahoo.com> wrote in message
news:eFIbqNjYFHA.2264@TK2MSFTNGP10.phx.gbl...
:
: I migrated a web server from IIS 4 to IIS 6. The Windows Scripting
: Object, which I was using to copy a file, no longer seems to work. The
: script is as follows. It is embedded in an ASP page, which now returns
: "The page cannot be displayed" when it hits the WshShell.Run line. The
: code in question is as follows:
:
: 'Create a file handling object:
: Set FileSys = Server.CreateObject("Scripting.FileSystemObject")
: FileName = FileSys.GetTempName
: 'Create a Windows Scripting Host Object -
: Set WshShell = Server.CreateObject("WScript.Shell")
: 'Run this batch file with the WSH object -
: ret=WshShell.Run("F:\phonedbapps\NewPic.bat " & strPictureID & " " &
: FileName, 1, true)
:
: The batch routine NewPic.bat is run from an IIS directory with execute
: permissions:
: copy D:\tempwork\tempwork.jpg D:\pictures\%1.jpg
:
: ------------------------------------------------------------
:
: I also experimented with using the File System Object from ASP, but it
: also returns "The page cannot be displayed" when it hits the line
: containing ScriptObject.MoveFile. The code is as follows:
:
: 'Create a file handling object:
: Const OverwriteExisting = True
: Set ScriptObject = Server.CreateObject("Scripting.FileSystemObject")
: ScriptObject.MoveFile "//SRV1/tempwork/tempwork.jpq",
: "//SRV1/testwork/testwork.jpg"
:
: I'm now stumped and out of ideas.

It's looking for a physical path to the file. If you're trying to write
using a UNC path, then you need to give the anonymous user of the web
server, modify rights on the remote system.

If it's on the same system, just use Server.MapPath.

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp





Re: WSH no longer works from ASP by Roland

Roland
Fri May 27 04:47:15 CDT 2005

"Roland Hall" wrote in message news:u4WVf$pYFHA.3660@TK2MSFTNGP10.phx.gbl...
:
: It's looking for a physical path to the file. If you're trying to write
: using a UNC path, then you need to give the anonymous user of the web
: server, modify rights on the remote system.
:
: If it's on the same system, just use Server.MapPath.

If it's outside the web root on the same system, just specify the physical
path:

fso.MoveFile "d:\tempwork\tempwork.jpg","d:\pictures\mypic2.jpg"

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp