• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1494
  • Last Modified:

Copy files from server to multiple computers

I have a text file of computer names that I would like to update with a file stored on a server. For example, to use robocopy for instance:

\\server1\robocopy "\\server1\FileToCopy" "computer1\c$\documents and settings\all users\desktop" /e /XO /R:3 /W:3

Except instead of hard coding the computer name in the script, I would like to loop through a file of computer names. Is there a way to do this using robocopy, or is there a better way?
0
CADOIM
Asked:
CADOIM
  • 13
  • 9
1 Solution
 
TDKDCommented:
I would use %username% for the computer name, this way it will copy to the computer of whoever is running it.

I assume the user will run this when logging into their computer?
0
 
TDKDCommented:
oops, I meant %computername%
0
 
CADOIMAuthor Commented:
Ok this is what I get when I run the following code in the command prompt:

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.



C:\>\\Attefs-075im-01\CA-IM\Programming\Code\BatchFiles\robocopy "\\Attefs-075im
-01\CA-IM\Programming\Code\testing" "%attewk-im-22%\C:\Documents and Settings\al
l users\Desktop" /e /XO /R:3 /W:3

----------------------------------------------------------------------
ROBOCOPY v 1.96  :  Robust File Copy for Windows NT
----------------------------------------------------------------------

  Started : Fri Nov 07 12:18:44 2008

   Source : \\Attefs-075im-01\CA-IM\Programming\Code\testing\
     Dest : C:\%attewk-im-22%\C:\Documents and Settings\all users\Desktop\
    Files : *.*
  Options : *.* /S /E /XO /R:3 /W:3
ERROR 123 (0x0000007B) Accessing Destination Directory C:\%attewk-im-22%\C:\Docu
ments and Settings\all users\Desktop\
The filename, directory name, or volume label syntax is incorrect.

This will not go in the All Users startup folder, instead it will be stored on the server and I will run it to push updates after I have made changes.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
TDKDCommented:
Will you be connected to the users computer via RDP when making changes?
0
 
CADOIMAuthor Commented:
No, I was hoping to use something like "computername\C$" to update their files.
0
 
TDKDCommented:
ok, you obviously have local Admin rights on their computers? You could copy a batch file to their root of C, then via telnet execute it.
0
 
TDKDCommented:
I can help you write one if you tell me what files/file you wish to copy to the users desktop?
0
 
CADOIMAuthor Commented:
Yes, I do have admin rights. Executing the file via telnet would work, but I would like to avoid this because every time we reimage the system we will have to put the file back in the root of C:
0
 
TDKDCommented:
Something like this would work:

xcopy /e "\Server\isusers\file" "C:\Documents and Settings\%username%\Desktop"
0
 
TDKDCommented:
xcopy /e "\\Server\isusers\file" "C:\Documents and Settings\%username%\Desktop"

I left out a \ on the last one.

I have setup a GPO that is user specific that always copys certain data to their desktop, no matter where they are.

But in your case you could simply add the above to their logon script?
0
 
CADOIMAuthor Commented:
The xcopy works, but I do not want this to run every time a user logs in. If I only make updates every couple of weeks, I'd rather not waste system resources by re-copying the same file each morning when they log in. Is there not any way I can write a script that I can run from my own system after I make changes?
0
 
TDKDCommented:
Ok, will it be the same computers every couple of weeks?
0
 
CADOIMAuthor Commented:
For the most part, yes. The computers may change however, which is why I was wanting to loop through a text file of the computer names that need to be updated. That way instead of changing hard-coded computer names, I can just update the text file.
0
 
TDKDCommented:
Not to be a nudge, but I am not sure how to reference a text file, though it sounds like it would be just as easy to update the names in the batch file?
0
 
TDKDCommented:
The batch file would look something like:

xcopy /e "\\Server\isusers\file" "C:\Documents and Settings\Dan-1\Desktop"
xcopy /e "\\Server\isusers\file" "C:\Documents and Settings\Dan-2\Desktop"
xcopy /e "\\Server\isusers\file" "C:\Documents and Settings\Dan-3\Desktop"
xcopy /e "\\Server\isusers\file" "C:\Documents and Settings\Dan-4\Desktop"
xcopy /e "\\Server\isusers\file" "C:\Documents and Settings\Dan-5\Desktop"

and so on...
You would be able to simply double click on the batch file anytime you needed to update the users PC in question, from your own desktop.

Hope this helps
0
 
CADOIMAuthor Commented:
Yes, that will work, but only on the profiles on the system it is ran from right? Is there a way to reference other computers? The goal is for me to run the batch file from my system and update user profiles on other computers.
0
 
CADOIMAuthor Commented:
For example, something like:

xcopy /e "\\Server\isusers\file" "computername\C:\Documents and Settings\All Users\Desktop"

The code you provided only copies to the root of C on the system it is ran from.
0
 
CADOIMAuthor Commented:
This works:

xcopy /e "\\ServerName\DirectoryPath" "\\ComputerName\c$\DirectoryPath"

Thanks for showing me the xcopy function, that's how I figured it out. It was the C$ after all.
0
 
TDKDCommented:
That makes perfect sense, good job :-)
0
 
TDKDCommented:
Thats what answering tons of phone support calls and drinking too much coffee with excedrin will do to a man...lol
0
 
TDKDCommented:
and if there is specific files you want to exclude, just let know and I will post my exclude batch commands and how to impliment it :-)
0
 
CADOIMAuthor Commented:
You can if you want for other's reference, but I have no need for it at this point. Go ahead and post the solution and I'll mark and award points. Thanks again.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 13
  • 9
Tackle projects and never again get stuck behind a technical roadblock.
Join Now