Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Need to copy a file to every computer in domain, with conditions

$
0
0

I have an uninstaller file that I need to copy to every computer in a domain, but because of traffic restrictions/WAN issues I only want that file to copy under certain circumstances:

1) I only want the file to copy if it does not exist on the destination computer

2) I only want the file to attempt to copy if the computer in question responds to a ping/network test of some sort.

Right now I'm just using something simple:

#$computers = Get-QADComputer -sizelimit 0 |  where{$_.operatingSystem -notlike "*Server*"} | ForEach-Object {$_.Name} 
$source = "C:\temp\1.60.2.0003.exe"

foreach ($computer in $computers) {
copy-item $source -Destination "\\$computer\c$\temp"
write-host "copied to $computer"

But my networking group is yelling at me for using up too much WAN bandwidth to sites with slow links and for creating so much traffic.


zarberg@gmail.com


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>