Link to home
Start Free TrialLog in
Avatar of cooljam23
cooljam23

asked on

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.

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Lee W, MVP
Lee W, MVP
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of cooljam23
cooljam23

ASKER

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?

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

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

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

Bob
Thanks - I will keep that in mind
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%"
:end
@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.
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.