Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Script to Copy folder from SQL to web Server in DMZ

Posted on 2009-02-10
Medium Priority
Last Modified: 2013-12-02
The setup-  SQL server on LAN (192.168.0.X), Webserver in DMZ (Outside address, Internet IP Inside address , 172.16.16.X).  Both are Server2003... Web server access SQL server for data but in order to display documents to customers, the webserver must have document images on the local drive.  Need script to copy a folder containing documents, pdfs, etc.  from the SQL server to the web server.  
Question by:BillTant
  • 3

Expert Comment

ID: 23612597
If you are talking about a .vbs script you can find what you need at Microsoft script repository
I have attached a script from the above MS site (you find it below) that will copy a set of files and also one for copying a folder.
You can probably run this as a scheduled task if you like or just from a command shell using
CSCRIPT <scriptfilename>
/ Mikael

' Copy file set
Const OverwriteExisting = TRUE
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CopyFile "C:\FSO\*.txt" , "D:\Archive\" , OverwriteExisting
' Copy a folder
Const OverWriteFiles = TRUE
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CopyFolder "C:\Scripts" , "C:\FSO" , OverWriteFiles

Open in new window


Author Comment

ID: 23624265
Thanks activephoto but that seems way more than I need and beyond my understanding.

I've mapped a drive on the SQL server ( X:--> \\Web server\Documents).  I'm not sure of the securty issues but sincethe mapped  I then created a .bat file with the following...
robocopy C:\PestPac.NET\Documents X: *.* /E /COPYALL /R:3 /W:3
When ran from the cmd prompt it works fine but when ran as a scheduled task the last result is "0x10".

What does 0x10 mean and how do I fix it?

Author Comment

ID: 23624415
Sorry hit the submit too soon.

sincethe mapped  .>> since the mapped drive is on the SQL server behind the firewall I don't think a hole is opened.
A few more details,  The SQL server is in a domain but the web server is its own workgroup.

Accepted Solution

BillTant earned 0 total points
ID: 23633333
Wow,  I'm surprised at how little response.  Below is the final script I wrote which works.  I had hoped to save time by using EE.
@echo off
net use x: /delete
net use X: \\172.16.XXX.XXX\docs /user:administrator password
robocopy C:\File\Documents x: *.* /E /COPYALL /R:3 /W:3
net use x: /delete

Open in new window


Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello, As I have seen there a lot of requests regarding monitoring and reporting for exchange 2007 / 2010 / 2013 I have decided to post some thoughts together and link to articles that have helped me. Of course a lot of information you can get…
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
Suggested Courses

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question