Wanting to push out a file from server to c:\windows on clients pc

Hi All,

I've asked this question before but was unsuccessful in receiving the solution.

I want to push out a wallpaper file to c:\windows on client's pc, now I have tried putting xcopy command in log in script and that doesn't work as you need the admin rights to copy file to c:\windows

I have tried start up script (VBS) but was unable to get the right syntax for it.

What would be the easiest way to do this?  I want the file to be in c:\windows and I would then set up the wallpapaer in AD GPO.

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

Lee W, MVPTechnology and Business Process AdvisorCommented:
Two suggestions:
1.  Make a GPO login script - not a standard login script.  I've seen several people stating that GPO scripts run under the "SYSTEM" user and as a result, have access to the otherwise protected areas of the disk.

2.  Simple script (single command really) to copy the file to all network machines that any domain admin can run.
for /f "tokens=1" %a in ('net view ^| find "\\"') do copy c:\file.bmp %a\admin$

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
cooljam23Author Commented:
1.  What would the command be for the script?

2. I don't quite follow the command.  The file is stored on a server\shared folder\ and it needs to be copied to c:\windows on client's pc.  Does that command do exactly that?

Lee W, MVPTechnology and Business Process AdvisorCommented:
1.  You would have to setup a GPO login script - first, create a Group Policy object in Active Directory.  Then Edit it.  you'll find there's a section for logon scripts as well as log off scripts.  I don't remember exactly how off hand, but with a right click or two, you should be able to open the folder that contains or would contain the scripts.  Then create one with a simple:
"copy \\server\share\path\file.bmp %windir%"

2.  The following command should also do what you ask for, modify "server" to your server name and "share\path" to the share and path necessary to locate the file:

        for /f "tokens=1" %a in ('net view ^| find "\\"') do copy "\\server\share\path\file.bmp" "%a\admin$"

To break it down, the for command will loop through each line that appears in a text file, command's output, or some other criteria. (type for /? for an more detailed explanation).  the tokens=1 means use the first "column" of data - delimited by default with tab and space characters and assign that column to the variable %a.  the in part essentially means to use the data output from the following command (in parenthesis).  The command is

net view | find "\\"    - you can run this alone at a command prompt and see the output.  net view displays a list of all the systems on the network that it can see view the browser service.  The | means feed that data to the next command following the | symbol - which in this case is "find" - we're basically saying "find all lines that have "\\" in them from the output of the net view command.  This keeps us from attempting to connect to non existant systems because the first few lines of output from net view are not systems.

the do means for each item in the list, do this command.  The command being copy the file from the server to the admin$ share on the target computer.  Make sense?
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

cooljam23Author Commented:
1.  Would that be a vbs file or bat file?  Sorry i've got only a little bit of knowledge on scripting.

I'll try the second option later.

Just curious why you want to put the file on the local machine?
I just use a GPO and set the background to a file on the server - no scripts

Scalibility.  The last thing I would want is 250 (100, 1000, 5000, etc.) people in the morning launching their PCs and hammering my server for a 500K background.  It would be better to put the background on the local machine and have the GPO point to c:\windows\whatever.jpg/bmp rather than \\server\share\whatever.jpg/bmp

Thanks - I will keep that in mind
cooljam23Author Commented:
Still waiting for leew to reply back

the copy command doesn't look like it's a vbs command, more like a batch command?  I don't know if you could put a batch file in to the start up script in GPO.

Cooljam - The copy would be either
file.bat or file.cmd

You can place a batch file in the startup script in a GPO.

1.  The one with the simple copy command would be ran in a script in a GPO.
I would suggest the following
(Filename copybg.bat or something similar)

@Echo Off
if exist "%windir%file.bmp" goto end
"copy \\server\share\path\file.bmp %windir%"
@exit  (or just exit)

2.  The one where you are hitting every machine would be ran from an administrative worstation with a DA logged in.
Lee W, MVPTechnology and Business Process AdvisorCommented:
Sorry, lost track of the thread - though I could swear I posted a comment on this that it was a batch command -  rarely do VBS scripts.
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 2000

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.