Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: robocopy do not write log files to UNc path

840 views
Skip to first unread message

Torgeir Bakken (MVP)

unread,
Apr 26, 2005, 10:54:42 AM4/26/05
to
nemi wrote:

> 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

nemi

unread,
Apr 26, 2005, 11:16:02 AM4/26/05
to
thank you for answer: my problem is: I wrote the fallowing script.
#######
Dim WshShell
Dim bKey
Dim vntVarName
Dim strUserDir
Dim ComName

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

Torgeir Bakken (MVP)

unread,
Apr 26, 2005, 11:35:55 AM4/26/05
to
nemi wrote:

> (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

nemi

unread,
Apr 27, 2005, 3:26:05 AM4/27/05
to
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

nemi

unread,
Apr 27, 2005, 7:14:02 AM4/27/05
to
Additionaly Information: now i noticed that at all no files are copied. Only
what my script did is: REG_KEY is produced and the KEY VELUE increased.
for each halp I am grateful.
Thanks

Torgeir Bakken (MVP)

unread,
Apr 27, 2005, 7:23:27 AM4/27/05
to
nemi wrote:

> 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...

nemi

unread,
Apr 27, 2005, 7:38:07 AM4/27/05
to
is there may be a authorization problem over network?
is every thing oK with script code?

Torgeir Bakken (MVP)

unread,
Apr 27, 2005, 8:13:25 AM4/27/05
to
nemi wrote:

> 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

nemi

unread,
Apr 27, 2005, 9:04:03 AM4/27/05
to
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.

Torgeir Bakken (MVP)

unread,
Apr 27, 2005, 10:11:13 AM4/27/05
to
nemi wrote:

> 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

Torgeir Bakken (MVP)

unread,
Apr 28, 2005, 7:57:52 AM4/28/05
to
nemi wrote:

> 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 ...

nemi

unread,
Apr 28, 2005, 7:06:04 AM4/28/05
to
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?
thank you for your assistance
0 new messages