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?
CADOIMAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

TDKDTechnical LiaisonCommented:
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?
TDKDTechnical LiaisonCommented:
oops, I meant %computername%
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.
Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

TDKDTechnical LiaisonCommented:
Will you be connected to the users computer via RDP when making changes?
CADOIMAuthor Commented:
No, I was hoping to use something like "computername\C$" to update their files.
TDKDTechnical LiaisonCommented:
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.
TDKDTechnical LiaisonCommented:
I can help you write one if you tell me what files/file you wish to copy to the users desktop?
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:
TDKDTechnical LiaisonCommented:
Something like this would work:

xcopy /e "\Server\isusers\file" "C:\Documents and Settings\%username%\Desktop"
TDKDTechnical LiaisonCommented:
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?
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?
TDKDTechnical LiaisonCommented:
Ok, will it be the same computers every couple of weeks?
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.
TDKDTechnical LiaisonCommented:
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?
TDKDTechnical LiaisonCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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.
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.
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.
TDKDTechnical LiaisonCommented:
That makes perfect sense, good job :-)
TDKDTechnical LiaisonCommented:
Thats what answering tons of phone support calls and drinking too much coffee with excedrin will do to a man...lol
TDKDTechnical LiaisonCommented:
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 :-)
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.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Networking

From novice to tech pro — start learning today.