Powershell copy files to computers.

Copy files to computers using Powershell

$computers = Get-Content "C:\filewithcomputers.txt"
$fileToCopy = "C:\file.exe"
ForEach($computer in $Computers){
    $destinationx86 = "\\$computer\C`$\"
    $destination = "\\$computer\C`$\"
    If(Test-Path $destinationx86){
        # Copy this to C:\
        Copy-Item -Path $fileToCopy -Destination $destinationx86     
    } Else {
        # Copy this to C:\temp
        Copy-Item -Path $fileToCopy -Destination $destination
    }
}

You may also like...