How to copy files or folders to all computers via GPO

Using Group Policies, you can automatically copy specific files or folders to all computers in the domain . You can place files on the desktop, a user profile folder, or any other directory on a local drive. Using the GPO, you can automatically copy or update different configuration files, INI files, EXE files, DLL libraries or scripts from a shared repository.

For example, I want to copy two files (app.exeand settings.xml) for the desktops of some Active Directory domain users.

Read more:

Fix printer error that does not appear in Windows RDP session
New Windows 10 update removes files from the desktop
Resolve the CREDSSP authentication error via Regedit
Schedule a reboot on Windows Server
Best Practices for Active Directory FSMO Functions

First, create a shared folder to keep the source files to be copied to users' computers. It can be a shared network folder on a dedicated file server or the SYSVOL directory on a domain controller (this folder is automatically replicated between all DCs in the domain using DFS, it is convenient to use it, as it helps to reduce the load on the WAN links). I put the files into the Sysvol folder: \\ dicasdeinfra.com.br \ SYSVOL \ dicasdeinfra.com.br \ scripts \ CorpApp. Make sure the group Authenticated users have read permissions on this folder.

1- Create an Active Directory security group - CorpAPPUsers
You can create a group using this PowerShell cmdlet: 

New-ADGroup CorpAPPUsers -path 'OU = Groups, OU = DE, dc = tipping tips, DC = com, DC = br' -GroupScope Global -PassThru –Verbose

Add users to the group whose desktop you want to automatically copy files to via the GPO:

Add-AdGroupMember -Identity CorpAPPUsers -Members fsantos, ateixeira, gsilva

2- Open the Group Policy Management console (gpmc.msc);
3- Create a GPO object (CopyCorpApp) and link it to the OU that contains users' computers;

4- Go to the edit mode GPO (Edit);

5- Expand the following Group Policy Preferences section: User Configuration -> Preferences -> Windows settings -> Files;

6- Select New -> Archive;

7- Specify a source file in the shared network folder and the destination directory on a computer to which you want to copy the file.

#Profissa: Take a professional course!
Ensure a certified course in IT and Software through the online study platform Udemy.
click here and check out all the latest technology courses!

8-There are 4 actions that are available to copy files using GPO:

  • Create - a file is copied to a destination directory only if the file does not exist there;
  • Replace - a destination file on a user's computer is always replaced with a source file;
  • Update (a default policy) - if a file already exists, it is not replaced by the source file;
  • Delete - deletes the destination file.

9- You can choose a specific folder on a computer as the destination directory or use environment variables. To copy files to the current user's desktop, use%DesktopDir%.

10- To copy files to the desktops of specific users, open the Common tab in policy settings, enable the option Item-level targeting and click Targeting;

11- In the next window, you can select more options on how to apply the GPO. In my case, I would like to restrict the policy to only members of the CorpAPPUsers group. To do this, click New Item -> Security Group and select a domain user group;

12- As we link the GPO to the Organizational Unit that contains computers (instead of users), the GPO loopback processing mode must be enabled: check Configure user Group Policy loopback processing mode = Merge in Computer Configuration -> Policies -> Administrative Templates -> System -> Group Policy;

13- Then, update the Group Policy settings on the client computers ( gpupdate / forceor log off and log on again) and make sure that two files were automatically copied to the Desktop.

Was this article helpful?

To maintain a quality standard for you, we have invested in a great hosting plan, Paid CDN, Website Optimization Plugins, etc ...

Help us to keep the project active! 

Follow the news in real time. Follow our Instagram profile.

Felipe Santos
Felipe Santos is a Cloud and Security Architect, with experience in Windows Server, Cluster, Storages, Backups Veeam and Office 365 environments.
en_USEnglish

UP TO 90% DISCOUNT

TAKE OFF YOUR CAREER !!

Do you want to upgrade your career? 

Invest in yourself and get ahead! Get that dream job in 2021!