Blackduke77
asked on
VBS and %lOGONSERVER%
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\l ogo\"
strDestination = "c:\windows\system32\logo\ "
'========================= ========== ========== ========== ========== =========
SynchroniseFiles strSource, strDestination
function SynchroniseFiles(byval strSourceFolder, byval strDestinationFolder)
CheckForBackSlash strSourceFolder
CheckForBackSlash strDestinationFolder
dim objFSO
set objFSO = Createobject("scripting.fi lesystemob ject")
if not objFSO.folderexists(strDes tinationFo lder) then
objFSO.createfolder(strDes tinationFo lder)
end if
dim file
for each file in objFSO.getfolder(strSource Folder).fi les
if not objFSO.fileexists(strDesti nationFold er & file.name) then
objFSO.copyfile file, strDestinationFolder & file.name
else
if file.DateLastModified > objFSO.getfile(strDestinat ionFolder & file.name).DateLastModifie d then
objFSO.copyfile file, strDestinationFolder & file.name
end if
end if
next
set objFSO = nothing
end function
function CheckForBackSlash(byref strFolder)
if right(strFolder, 1) <> "\" then
strFolder = strFolder & "\"
end if
end function
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\l
strDestination = "c:\windows\system32\logo\
'=========================
SynchroniseFiles strSource, strDestination
function SynchroniseFiles(byval strSourceFolder, byval strDestinationFolder)
CheckForBackSlash strSourceFolder
CheckForBackSlash strDestinationFolder
dim objFSO
set objFSO = Createobject("scripting.fi
if not objFSO.folderexists(strDes
objFSO.createfolder(strDes
end if
dim file
for each file in objFSO.getfolder(strSource
if not objFSO.fileexists(strDesti
objFSO.copyfile file, strDestinationFolder & file.name
else
if file.DateLastModified > objFSO.getfile(strDestinat
objFSO.copyfile file, strDestinationFolder & file.name
end if
end if
next
set objFSO = nothing
end function
function CheckForBackSlash(byref strFolder)
if right(strFolder, 1) <> "\" then
strFolder = strFolder & "\"
end if
end function
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.