Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 157
  • Last Modified:

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
0
cooljam23
Asked:
cooljam23
  • 3
  • 3
  • 2
  • +1
1 Solution
 
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$
0
 
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?

thanks
0
 
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?
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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.

thanks
0
 
tmorrison3Commented:
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
0
 
flyguybobCommented:
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
0
 
tmorrison3Commented:
Thanks - I will keep that in mind
0
 
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.

0
 
flyguybobCommented:
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.
0
 
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.
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.

  • 3
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now