Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Copy Multiple Files to Remote servers

$
0
0

Hi ,

I need a help to Copy Multiple files to remote servers .. Basically I had created a Schedule Task

in windows 2012 server and had export it to xml  so need to copy 2 bat files  and one xml files to multiple servers and then create a Schedule task by Importing XML .. Can any one please help ..

Here is the script i had try but it give me error also did not find any help  to create a Schedule task by Importing XML on Remote computer and create a schedule task

$computers = gc "C:\scripts\computers.txt"

$source="c:\windows\temp\test.XML","C:\windows\temp\File1.bat","C:\windows\temp\File2.bat"

$dest = "\\c$\windows\temp"

 

foreach ($computer in $computers) {

 

    if (test-Connection -Cn $computer -quiet) {

 

        Copy-Item $source -Destination \\$computer\$dest -Recurse

 

    } else {

 

        "$computer is not online"

    }

 

}


Viewing all articles
Browse latest Browse all 6937

Trending Articles