I have a config file: Agent File installed on 80 Servers with the same name "agent.conf" .
What I want to do is to copy all files from all adcomputers then rename them according to each server name to one localtion
Like $Computers = Get-ADComputers -Filter * | Select -Expand Name
then loop through each and go to C:\path and copy each file and attach $_computer name to that file
Same idea, but you'll need to reverse it basically. Copy from remote computer and rename it with computername. Also you'll need to have PS Remoting enabled on the computers, otherwise youll need to use \\computername\c$\path, if that's also enabled.
How I would do it, Collect your servers, test-connection that those are online, if not catch offline computers and if it is online, copy file with new name, also could catch servers that do not have the file for example.