> I'm trying to write a script that copy same files from Server1 to Clients
> during Logon.
> Every thing goes fine. The files copied but the problem i donot see any log
> files. Tey will not be created. Wenn i run script localy from client, then
> the log files created.
> Can anybody help me??
Hi,
I have no problem using an UNC path in the log file path
for robocopy.exe, like this:
robocopy.exe source destination /log:\\server\share\copy.log
This with the Robocopy.exe available here:
Windows Server 2003 Resource Kit Tools
http://www.microsoft.com/downloads/details.aspx?FamilyID=9d467a69-57ff-4ae7-96ee-b18c4790cffd&DisplayLang=en
(The kit will install on WinXP or later and you can copy only
needed files to other computers, also Windows 2000)
--
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scriptcenter/default.mspx
Set WshShell = CreateObject("Wscript.Shell")
Set vntVarName = WshShell.Environment("Process")
Set WshNetwork = WScript.CreateObject("WScript.Network")
On Error Resume Next
strUserDir = vntVarName("USERPROFILE")
bKey =
WshShell.RegRead("HKLM\SOFTWARE\Microsoft\Office\11.0\PowerPoint\Filecopy\Version")
ComName = WshNetwork.ComputerName
If CStr(bKey) = "" Then
WshShell.RegWrite "HKLM\SOFTWARE\Microsoft\Office\11.\PowerPoint\Filecopy\_
Version", "0", "REG_SZ"
bKey = 0
End If
If bKey = "1" Then
SRDir1 = "\\Server1\NETLOGON\Templates" 'Source Folder 1
DESDir1 = strUserDir&"\My Documents"
'Destination Folder 1
LOGDir = "\\Server1\TempLOG\"&ComName&".log" 'Log Folder
WshShell.Run ("robocopy """&SRDir1&""" """&DESDir1& """ *.ppt /ZB /COPY:DAT
/R:0 /W:0 /LOG+:"&LOGDir), OverWriteExisting
Set WshShell=Nothing
Set vntVarName=Nothing
End If
##############
so i wann to copy files from Server1 to Client. this scrip run from logon
script.bat during userlogon. the files are copied but the log files not. that
is my problem
> (snip)
Hi
If you change your WshShell.Run line to this:
WshShell.Run "%comspec% /c robocopy.exe """ & SRDir1 & """ """ _
& DESDir1 & """ *.ppt /ZB /COPY:DAT /R:0 /W:0 /LOG+:" & LOGDir _
& " >%tmp%\robocopy.txt", 0, True
what is the content of the file robocopy.txt in the temp folder?
(for me, it contains the text
Log File : \\server\share\robocopy.log
Thenk you again
> The Problem is still ansolved, i changed that and the robocopy.txt contains
> nothing (it is empty) i run script manually from client machine and now txt
> file contain \\server\share\ xxx.log.
> As i wrote bevore, the problem occurs only. during runing of the script
> automaticly.
> (Automaticly mean: i tried to run the script with a batch file or over GPO.)
>
> Thenk you again
Hi,
I can't really see why it should not work in a logon script, so I'm
afraid I have no more ideas about this...
> is there may be a authorization problem over network?
> is every thing oK with script code?
Hi
Replace the line
WshShell.Run ("robocopy """&SRDir1&""" """&DESDir1& """ *.ppt /ZB /COPY:DAT
/R:0 /W:0 /LOG+:"&LOGDir), OverWriteExisting
with this and see what happens:
Set objFSO = CreateObject("Scripting.FileSystemObject")
On Error Goto 0
If objFSO.FolderExists(SRDir1) Then
WshShell.Run "robocopy.exe """ & SRDir1 & """ """ & DESDir1 _
& """ *.ppt /ZB /COPY:DAT /R:0 /W:0 /LOG+:" & LOGDir, 0, True
Else
MsgBox "Could not find folder " & SRDir1, _
vbExclamation + vbSystemModal, "Robocopy job"
End If
> i replaced it and there is no changes. there will be nothing
> copyed. What i donot understand, if I click on the script
> explicitly, it functioned, but automatically it is not functioning.
Hi
If you use the run line below, it should open a "permanent"
command prompt where you should be able to see what robocopy
reports (I have removed the log file parameter as well):
WshShell.Run "%comspec% /k robocopy.exe """ & SRDir1 & """ """ _
& DESDir1 & """ *.ppt /ZB /COPY:DAT /R:0 /W:0", 1, True
> Hi,
> I solved the problem partial. The Problem was on my logon script.
> now i corrected it. But have a question. must be Robocopy
> installed on target the computer?
Hi,
No, you can run robocopy.exe from a share that the users have
read access to, like this:
WshShell.Run "\\server\share\tools\robocopy.exe """ & SRDir1 ...