3

I have a list of 150 computers on my Windows Active Directory network that I am trying to copy a files to. I wonder if someone might have a script that would, copy the files or shortcut to the computers by looking for the PC names in a text file.

MDMarra
  • 100,734
  • 32
  • 197
  • 329

1 Answers1

5

The right™ way to do this is to use a startup/logon script in GPO
or
Use a Group Policy File/Shortcut Preference item if your clients are Vista/7 or XP w/ the GPP Extensions add-on.

The reason that you don't want to do this the way that you proposed is that if a computer is not on or is unavailable or has a file locked, this won't work. A logon script or GPO gets around this restriction and guarantees that computers in your organization are compliant.


If you really want to use a script for this and feed it names, I recommend PowerShell. You can use Get-Content to read the list and pipe it to a ForEach-Object that will then contain a Copy-Item command with a destination of \\$_\C$\Path\To\Copy\To.

If you want more info on any of these cmdlets, just run Get-Help *command* -full. For example, if you wanted the full details w/ examples of how Copy-Item works, just run Get-Help Copy-Item -full.

MDMarra
  • 100,734
  • 32
  • 197
  • 329
  • `s/logon/computer\ startup/`, depending upon where the file needs to be placed of course. – Bryan Sep 28 '12 at 18:56
  • @Bryan I don't know *what* you're talking about ;-) – MDMarra Sep 28 '12 at 19:01
  • i really dont want to user GPO to get this done i pretty do all my deployment using KACE. i already have a batch file to get this done i used to write VBS script. just checking if anyone already have a script they would be willing to share but thanks for the information guys – Alex Alexander Sep 28 '12 at 20:48
  • So, if you already use KACE for config management why aren't you using KACE for this? Also, GPO and config management tools like KACE are complimentary technology. Many large scale deployments leverage *both* technologies to keep their environment in good shape. – MDMarra Sep 28 '12 at 20:54
  • i am using kace to deploy a the batch files – Alex Alexander Sep 28 '12 at 21:46