Posted on 2005-04-14
Last Modified: 2008-03-10
Hi guys please can you help me out here, I have a script that copies a file to the pc's system32 directory but I am having difficulty, I would like to set the %netlogon% as the source folder.

at the moment is errors saying "source folder not found" however I replace the source folder with a UNC server name and path it all works fine. I am in a desperate hurry for this so I have put 500 points on it, I would put 10,000 if I could thanks in advanced !!!

dim strSource, strDestination
strSource = "\\wfflongham01\netlogon\logo\"
strDestination = "c:\windows\system32\logo\"

SynchroniseFiles strSource, strDestination

function SynchroniseFiles(byval strSourceFolder, byval strDestinationFolder)

      CheckForBackSlash strSourceFolder
      CheckForBackSlash strDestinationFolder
      dim objFSO
      set objFSO = Createobject("scripting.filesystemobject")
      if not objFSO.folderexists(strDestinationFolder) then
      end if

      dim file
      for each file in objFSO.getfolder(strSourceFolder).files
            if not objFSO.fileexists(strDestinationFolder & then
                  objFSO.copyfile file, strDestinationFolder &
                  if file.DateLastModified > objFSO.getfile(strDestinationFolder & then
                        objFSO.copyfile file, strDestinationFolder &
                  end if
            end if

      set objFSO = nothing

end function

function CheckForBackSlash(byref strFolder)
      if right(strFolder, 1) <> "\" then
            strFolder = strFolder & "\"
      end if
end function

Question by:Blackduke77
    1 Comment
    LVL 7

    Accepted Solution

    I suspect that the problem you were having is with the expansion of the %LOGONSERVER% environment variable.  If you were to use something like this:

    Set objWSHShell = WScript.CreateObject("WScript.Shell")
    strSource = objWSHShell.ExpandEnvironmentStrings("%LOGONSERVER%\netlogon\logo\")

    You would probably be able to overcome this.  Good luck!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Course: HTML5 Mobile App Development with PhoneGap

    PhoneGap can help you leverage your already existing HTML5, JavaScript, and CSS skills in order to create and deploy cross-platform mobile apps.This program comprehensively covers HTML5 mobile app development from top to bottom.

    Suggested Solutions

    This article is filled with multiple code samples and explanations for mathematical calculations. They are as follows: 1. General tips 2. Quadratic formula 3. Object collision 4. Projectile path General Tips       Here are some of my tips f…
    If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
    An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
    In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

    794 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

    16 Experts available now in Live!

    Get 1:1 Help Now