Test network with filecopy and Powershell

Needed a way to test and time filecopy between servers using powershell. This is what I came up with. This example will use copy testfile.zip to server and time the progress. I used a file of 1.8 Gb.

$servers=”server1″,”server2″,”server3″,”server4″,”server5″,”server6″
foreach($server in $Servers){
if (!(test-path \\$server\share\temp)) {
    new-item -path \\$server\share -name temp -ItemType Directory
}
$start = get-date
copy-item C:\temp\testfile.zip -Destination \\$server\share\temp\testfile.zip
$end = get-date
Remove-Item \\$server\share\temp\testfile.zip
[TimeSpan]$Totaltid = new-timespan $start $end
write-host $($server) – $($Totaltid.seconds)s
}

Leave a Reply