Script to Copy folder from SQL to web Server in DMZ

Posted on 2009-02-10
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
    LVL 6

    Expert Comment

    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

    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

    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

    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

    The problems with reply email signatures

    Do you wish that you could place an email signature under a reply? Well, unfortunately, you can't. That great Exchange/Office 365 signature you've created will just appear at the bottom of an email chain. What a pain! Is there really no way to solve this? Well, there might be...

    Join & Write a Comment

    Suggested Solutions

    The password reset disk is often mentioned as the best solution to deal with the lost Windows password problem. In Windows 2008, 7, Vista and XP, a password reset disk can be easily created. But besides Windows 7/Vista/XP, Windows Server 2008 and ot…
    Hyper-convergence systems have taken the IT world by storm and have quickly started to change our point of view of how the data center should and could be architected. In this article, I’ll explain the benefits of employing a hyper-converged system …
    This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
    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…

    745 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

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now