How to copy new files to multiple computers using Group policy (GPO)

Did you Ever want to simply copy some files to your entire forest, domain or just a group of computers?

The easiest way, that is if your computers are in domain environment, is to use GPO – group policy object that runs a startup script.

There are lots of ways to make mistakes on this topic. So stay alert.

Create a new group policy object and link it to the OU where your computers accounts are in:

  • GPMC.msc > Create a new GPO > give it a name like: CopyFiles > link it to the desired OU>Open Group Policy Object Editor (right-click your policy>edit)

gpmc edit

  • In Group Policy object/Computer Configuration/Windows Settings/Scripts (Startup/Shutdown)> double-click startupstartup properties
  • In the Startup Properties dialog box, click Show Files. A new window will open under: \\DOMAIN.com\SysVol\DOMAIN.com\Policies\{Policy GUID}\Machine\Scripts\Startup.  We need to put our script in this location.
  • Right click this empty window > select new > text document. Name this file: copyfiles.cmd.
  • Right click copyfiles.cmd > select edit.

Place your files in the NETLOGON directory

Now you need to place your files in a folder inside the NETLOGON directory.

This way your files will be replicated to all domain controllers so there is no specific place in which computers need to reach, in order to copy the files. For example: \\DOMAIN.com\NETLOGON\FilesToCopy

netlogon

Write the script that copies the files

I find that the best way is using xcopy command. I added the /D parameter as well to the command, it copies only those files whose source time is newer than the destination time If no date is given:

Xcopy MyDOMAIN\NETLOGON\FilesToCopy\*.* C:\ /D

Save and close your batch file. Close the : \\DOMAIN.com\SysVol… window

In the startup properties windows click add > click browse > select copyfiles.cmd. Click open > click ok > click ok

The startup properties window should look like this:

startup script copy files

That’s it. You now have a startup script that copies only newer files to your desired  domain computers.

 

Leave a Reply