<

The headache of GPO and bulk Copying Files to Domain Joined Computers

29 Points
29 Views
Last Modified:
Mohammed Hamada
I am a senior IT consultant for Azure, Telecom, Messaging and collaboration and Infra. I have been in the IT sector since 15 years.
While doing projects sometimes you have to work with the GPO to copy certain files, scripts to apply commands on domain joined Computers however, The GPO’s File/Folder copying might take long time to gets created and until replication through all clients is done you’ll have to wait...

While doing projects sometimes you have to work with the GPO to copy certain files, scripts to apply commands on domain joined Computers however, The GPO’s File/Folder copying might take long time to gets created and until replication through all clients is done you’ll have to wait for God knows how long in case of enterprise environments. 


After having to copy certain folder to about 800 machine immediately in order to apply certain folder that runs a script through GPO I had to find away to copy the files in fastest way possible and the only way was to create a script to copy this folder to all the machines straight ahead.


The script below will read computer hostnames, FQDN from a file that I exported from certain Organizational Unit and check if the Computer is online then copy folder to it if not it’ll report that it’s not online with Red font color and yellow background using Robocopy.


Hope this scripts will help someone out there.

#This Script will copy files to destination computers which you will define in a stored file.
#The Format of the CSV fille will contain only two columns (Name,DNSHostname) you can use the below script to export computer objects from certain OU.
#Get-ADComputer -Filter * -SearchBase “OU=Computers,DC=Domain,DC=com” | select name,dnshostname | Export-Csv C:\Computers.csv -NoTypeInformation
$computers = Import-Csv “C:\Computer.csv”
Start-Transcript
Foreach ($computer in $Computers){
$Fullcomp = $computer.dnshostname
If (Test-Connection -ComputerName $computer.name -Quiet) {
.\Robocopy.exe \\SourceServer\c$\nk2edit \\$Fullcomp\C$\nk2edit
Write-Host Files has been copied to $fullcomp -ForegroundColor Green -BackgroundColor black}else{
Write-host $computer.name is not online -ForegroundColor Red -BackgroundColor Yellow
}
}

clip_image001

0
Comment
0 Comments

Featured Post

Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

Join & Write a Comment

Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month